Trying to pull files from my Github repository: "refusing to merge unrelated histories"

MichaelSB

I'm learning git, and I'm following the Git community book.

Previously (long time ago) I made a public repository on Github, with some files. Now I set up a local Git repository on my current computer, and committed some files. Then I added a remote pointing to my Github page:

[root@osboxes c]# git remote add learnc https://github.com/michaelklachko/Learning-C

That seemed to be successful:

[root@osboxes c]# git remote show learnc
* remote learnc
  Fetch URL: https://github.com/michaelklachko/Learning-C
  Push  URL: https://github.com/michaelklachko/Learning-C
  HEAD branch: master
  Remote branch:
    master tracked
  Local ref configured for 'git push':
    master pushes to master (local out of date)

Now I want to download the files from my Github repo to my computer. I did this:

[root@osboxes c]# git fetch learnc
[root@osboxes c]# git merge learnc/master
warning: refname 'learnc/master' is ambiguous.
Already up-to-date.

However, I don't see any new files in my local directory. How can I get them?

I also tried to do this:

[root@osboxes c]# git pull learnc master
From https://github.com/michaelklachko/Learning-C
 * branch            master     -> FETCH_HEAD
fatal: refusing to merge unrelated histories

BTW, locally I'm on master branch (there are no other branches):

[root@osboxes c]# git status
On branch master
nothing to commit, working directory clean
Nevermore

Try --allow-unrelated-histories

Like max630 commented, or as explained here Git refusing to merge unrelated histories

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

git push rejected, Pull Failed: fatal: refusing to merge unrelated histories

From Dev

git subtree error "fatal: refusing to merge unrelated histories"

From Dev

Cant push or pull to my own Github repository

From Java

Pull new updates from original GitHub repository into forked GitHub repository

From Java

GitHub - Pull changes from a template repository

From Dev

How to upload my files in github repository with command?

From Dev

Remove deleted files from github pull request?

From Dev

Pull changes from github to local rails files

From Dev

Can I pull some files from a specific branch, modify them and push them to another branch in the same github repository?

From Dev

GitHub Clone - how to prevent pull requests from going to the original repository?

From Dev

Not able to pull or push in the github repository

From Dev

OSGI runtime cannot pull dependencies from my local repository

From Dev

Pull selected files to VPS repository

From Dev

Can I delete a forked Github repository when upstream hasn't accepted my pull request?

From Dev

Can I delete a forked Github repository when upstream hasn't accepted my pull request?

From Dev

Automatically copy pushed files from one GitHub repository to another

From Dev

How to get list files from a github repository folder using R

From Dev

GitHub get a list of all files in a repository from raw.githubusercontent?

From Dev

can't pull changes from github - Permission denied (publickey). fatal: Could not read from remote repository

From Dev

Github Webhook when somebody pulls code from my repository

From Dev

Github: Creating an inter-repository pull request?

From Dev

How to get files from a commit, to a folder outside from my repository?

From Dev

How to pull changes from the remote repository without pushing the local changes with Github Desktop

From Dev

GitHub: How to create pull request from forked repository to upstream repo only including some past commits

From Java

Git pull from another repository

From Dev

git pull from repository to server

From Dev

Pull a commit from a different repository

From Dev

Git Pull from a Forked Repository

From Dev

Downloading a repository from Github

Related Related

  1. 1

    git push rejected, Pull Failed: fatal: refusing to merge unrelated histories

  2. 2

    git subtree error "fatal: refusing to merge unrelated histories"

  3. 3

    Cant push or pull to my own Github repository

  4. 4

    Pull new updates from original GitHub repository into forked GitHub repository

  5. 5

    GitHub - Pull changes from a template repository

  6. 6

    How to upload my files in github repository with command?

  7. 7

    Remove deleted files from github pull request?

  8. 8

    Pull changes from github to local rails files

  9. 9

    Can I pull some files from a specific branch, modify them and push them to another branch in the same github repository?

  10. 10

    GitHub Clone - how to prevent pull requests from going to the original repository?

  11. 11

    Not able to pull or push in the github repository

  12. 12

    OSGI runtime cannot pull dependencies from my local repository

  13. 13

    Pull selected files to VPS repository

  14. 14

    Can I delete a forked Github repository when upstream hasn't accepted my pull request?

  15. 15

    Can I delete a forked Github repository when upstream hasn't accepted my pull request?

  16. 16

    Automatically copy pushed files from one GitHub repository to another

  17. 17

    How to get list files from a github repository folder using R

  18. 18

    GitHub get a list of all files in a repository from raw.githubusercontent?

  19. 19

    can't pull changes from github - Permission denied (publickey). fatal: Could not read from remote repository

  20. 20

    Github Webhook when somebody pulls code from my repository

  21. 21

    Github: Creating an inter-repository pull request?

  22. 22

    How to get files from a commit, to a folder outside from my repository?

  23. 23

    How to pull changes from the remote repository without pushing the local changes with Github Desktop

  24. 24

    GitHub: How to create pull request from forked repository to upstream repo only including some past commits

  25. 25

    Git pull from another repository

  26. 26

    git pull from repository to server

  27. 27

    Pull a commit from a different repository

  28. 28

    Git Pull from a Forked Repository

  29. 29

    Downloading a repository from Github

HotTag

Archive