Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

git - new user trying to do pull and getting some confusing messages

Tags:

git

I am pretty new to git. I have been primarily checking stuff into a repository, but now I want to get the latest changes from another developer.

I tried to simply do a command like git pull something ran, but it came back with a message like this:

There is no tracking information for the current branch.
Please specify which branch you want to merge with.
See git-pull(1) for details

    git pull <remote> <branch>

If you wish to set tracking information for this branch you can do so with:

    git branch --set-upstream develop origin/<branch>

So then I did git pull my_branch_name

and it came back with this:

fatal: 'develop' does not appear to be a git repository
fatal: The remote end hung up unexpectedly

but I had done git checkout my_branch right before that.

Could someone please let me know what I did wrong and how I can simply get the latest files that had been checked in?

Thanks!

like image 668
GeekedOut Avatar asked Aug 21 '12 11:08

GeekedOut


People also ask

How do I fix a git pull error?

You could try the following (with a clean working directory of course): Recursively delete my/folder/Name (the old location). Do git reset --hard origin/branchname (the branch you are pulling).

How do I fix error pulling not possible because you have unmerged files?

To fix the “pulling is not possible” error, you can use git reset –hard. Always write a commit message after adding a file to Git's history. Ensure your files are updated to avoid conflict when pulling changes. You need to commit your changes or stash them before you can merge.

Why is git pull not pulling latest commit?

One explanation would be that the latest commits have been done on another branch, as explained in "Git pull from my public repository not working". The other possibility is for you to be in a detached HEAD mode. That would make any git pull "up-to-date" since you are in any branch.


3 Answers

I think you missed the name of the remote when pulling:

git pull <remote> my_branch_name

Run this command:

git remote -v

And check what is the name of the remote you want to pull from

EDIT:

If you are new to Git, I would recommend you this book. It covers from basic to advanced topics, is easy to understand and to read

like image 57
davids Avatar answered Oct 18 '22 19:10

davids


As the first error message indicated, you need to tell git where to look when it pulls for that branch:

In Git 1.8 and up, ensure you've checked out develop and run:

git branch --set-upstream-to origin/develop

or the shorter:-

git branch -u origin/develop

In Git prior to version 1.8:

git branch --set-upstream develop origin/develop

Once you've done that you can git pull without having to specify the remote or the branch.

If the remote origin is not yet set up, first run:

git remote add origin url

like image 47
bcmcfc Avatar answered Oct 18 '22 18:10

bcmcfc


try this command:

git pull origin master
git push -u origin master
like image 44
navins Avatar answered Oct 18 '22 20:10

navins