How can I configure a default remote branch for when I git pull?
-
When I do `git pull`, I see this message: You asked me to pull without telling me which branch you want to merge with, and 'branch.master.merge' in your configuration file does not tell me either. Please specify which branch you want to merge on the command line and try again (e.g. 'git pull <repository> <refspec>'). See git-pull(1) for details. If you often merge with the same branch, you may want to configure the following variables in your configuration file: branch.master.remote = <nickname> branch.master.merge = <remote-ref> remote.<nickname>.url = <url> remote.<nickname>.fetch = <refspec> See git-config(1) for details.
-
Answer:
You can do this with a single command: git branch --set-upstream master origin/master
Pirkka Esko at Quora Visit the source
Other answers
In your .git/config file, you need to add a default branch for the remote repository you are are pulling from. In my case, the relevant section of my config looks like this: [branch "master"] remote = origin merge = refs/heads/master
Charlie Cheever
when you are pushing, you can set what it tracks by doing: git push -u <remote> <branch> to checkout a branch and have it track that remote branch: git checkout -t <remote>/<branch>
Joseph Hsu
You can make the config changes recommended by the error message from teh command line with... git config branch.<local-nickname>.remote <remote-nickname> git config branch.<local-nickname>.merge <remote-refspec> git config remote.<nickname>.url = <remote-url> git config remote.<nickname>.fetch = <refspec> For your particular error message, this might work: git config branch.master.remote origin git config branch.master.merge master You may also need to set up your remote nickname for origin: git remote add origin git://<your-repo-URL-here> And the default remote branch to merge with your local master branch (but I think this is usually the default). git config remote.master.fetch master
Hobson Lane
Related Q & A:
- How can I configure Outlook Express or Microsoft Express with yahoo mail?Best solution by Yahoo! Answers
- How can I stop a player in chess from freezing my game when I am winning in the middle or at the end of a game?Best solution by chess.com
- How can I configure my Outlook Express with Yahoo mail?Best solution by Yahoo! Answers
- How can I use a HDMI when my TV/Monitor doesn't have internal speakers?Best solution by Yahoo! Answers
- How can I get a text alert when I get an email?Best solution by Yahoo! Answers
Just Added Q & A:
- How many active mobile subscribers are there in China?Best solution by Quora
- How to find the right vacation?Best solution by bookit.com
- How To Make Your Own Primer?Best solution by thekrazycouponlady.com
- How do you get the domain & range?Best solution by ChaCha
- How do you open pop up blockers?Best solution by Yahoo! Answers
For every problem there is a solution! Proved by Solucija.
-
Got an issue and looking for advice?
-
Ask Solucija to search every corner of the Web for help.
-
Get workable solutions and helpful tips in a moment.
Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.