Tuesday, September 24, 2013

Git: The Current Branch is not Configured for Pull




Fixing the Git Error:  The Current Branch is not Configured for Pull


Are you trying to perform a git pull from a remote git repo within Eclipse?  Does the pull request work for your master branch but not on other branches?


Are you seeing an error message like below:



The current branch is not configured for pull
No value for key branch.develop.merge found in configuration


Or an error message such as the following:

The current branch is not configured for pullNo value for key remote.origin.url found in configuration



The current branch is not configured for pull. No value for key branch.develop.merge found in configuration.
Error message trying to pull from a remote git branch


Most likely, you created the branch locally and you haven't set the merge section of that branch and/or your local branch is not tracking the remote branch.  The problem lies in your git local configuration.

There are many ways to fix this but the most straightforward for me is the following:


Open up your Git Bash:

Location of git Bash command prompt
Open your git bash from the Start Menu


Right-click your project and click properties.  Get the location of your project in git.

Finding the location of your local project
Find the local git repo location of your project in your IDE



Go to your git prompt:


Your git bash command prompt
Git Bash command prompt


Change your directory to your project's directory.  Be sure to use forward slashes!

cd C:/Users/your-username/git/your-path

Checkout the branch


git checkout branchname

 Then push the local branch to your remote branch using the -u flag.  This will setup your pull settings automatically.


git push -u origin branchname


This should automatically update your local configuration and you should now be able to execute a git pull command for that branch from the remote repo.




Alternatively, you can modify the config directly

C:\Users\yourusername\git\yourprojectname\.git\config

Then add the following entry for your branch.


[branch "master"]
remote = origin
merge = refs/heads/master



--
APNSG5FMT284 Software Development Blogs - BlogCatalog Blog Directory