Github Windows 'Failed to sync this branch'

GitGithubGithub for-Windows

Git Problem Overview


I am using Github Windows 1.0.38.1 and when I click the 'Sync' button after committing, I get the error

enter image description here

How do I debug this problem? If in the shell, what should I do?

The sync works fine if i do a git push or git pull, but the next time I want to sync using Github windows, I get the same error.

Git Solutions


Solution 1 - Git

When it says that, just open the shell and do git status. That will give you a decent idea of what could be wrong and the state of your repo.

I can't give you a specific error for this as it happens for many reasons in Github for Windows, like say some problem in updating submodules etc.

Solution 2 - Git

This error comes because of a merge conflict in files. I faced it after I had updated my Maven Project's pom.xml but didn't commit it. Using

git status
error: Your local changes to the following files would be overwritten by merge:
<my project>/pom.xml
Please, commit your changes or stash them before you can merge.
Aborting

as the above post suggested helped finding any conflicting changes and you can decide to discard or commit.

Solution 3 - Git

I had the same problem. It happened to me because of some conflicting changes. I removed the local repository of my project from my desktop and then cloned it again from the github website (using clone option in my account), the error was gone.

Solution 4 - Git

I had the same problem when I tried from inside Visual Studio and "git status" in shell showed no problem. But I managed to push the local changes with "git push" via shell.

Solution 5 - Git

I had this problem and found it was to do with the proxy. I fixed the problem using this command:

 git config --global http.proxy %HTTP_PROXY%

Solution 6 - Git

This is probably an edge case, but every time I've got this specific error it is because I've recently mapped a drive in Windows, and powershell cannot find it.

A computer restart (of all things) fixes the error for me, as powershell can now pick up the newly mapped drive. Just make sure you connect to the mapped drive BEFORE opening the github client.

Solution 7 - Git

I had the same problem. In my case git could not find the global variable %HTTP_PROXY%, simply because Windows was not providing/using it.

I solved it by excluding the variable from the git config file (located in %USERPROFILE%\.gitconfig):

[http]
#	proxy = %HTTP_PROXY%

Solution 8 - Git

Have you changed your Windows password recently, or at least the one you use to connect to your proxy?

This was my problem, and git status couldn't help me. I had to change my login credentials in the ".git/config" file to get past this error.

Solution 9 - Git

This error also occurs if the branch you're trying to sync has been deleted.

git status won't tell you that, but you'll get a "no such ref was fetched" message if you try git pull.

Solution 10 - Git

One more thing that can cause this is when you map a network drive or connect a VHD after GitHub Desktop has already been started. The reason for this is that GitHub Desktop uses ssh-agent from the portable GIT install to establish connections, and never closes it... even if you uninstall the application. The process starts with no knowledge of the new drive and never refreshes itself, and when it is used to run the GIT commands to work on your repo it fails because it doesn't understand the paths.

The solution in this instance is to close GitHub Desktop and use Task Manager to terminate the running ssh-agent before starting it again. This will start a new instance of ssh-agent when needed which will pick up the new drive mappings, etc.

Solution 11 - Git

Make sure that the branch you are trying to push to isn't protected. I was trying to push to a protected branch and failed same as you.

Solution 12 - Git

check "git status" and "git pull" in the shell and find out what's wrong. and my problem is http.proxy node in config, therefore Github Windows should much more smart like just pop the shell and give more tips after the error(s) emit.

Solution 13 - Git

Along the lines of the HTTP Proxy answers, this can also happen due to a VPN connection. Disconnecting my VPN connection solved it for me.

Solution 14 - Git

I had the same issue, and "git status" also showed no problem, then i just Restarted the holy GitHub client for windows and it worked like charm.

Solution 15 - Git

I had the same issue. I removed the repo from the GitHub Windows client (right-click menu) and re-added it. When I re-added, I noticed I had about 300 uncommitted changes and it was reporting a memory error. I discarded all the changes and then sync started working fine again. (Rookie Git user - I'm sure there are better ways to do this on the command line)

Solution 16 - Git

The debug log may provide some insight. I'm using v3.3.4.0, your experience may differ but should be similar. From the settings menu choose 'About Github Desktop...'. Click the link to view the debug log. In my case there was a very clear error:

*** fatal error - cygheap base mismatch detected - 0x1157408/0x1167408. This problem is probably due to using incompatible versions of the cygwin DLL.

It even provided some helpful tips to solve the problem.

I'm not sure why this information isn't exposed in the error prompt, but at least it was available.

Solution 17 - Git

I tried with Android Studio to commit Changes and push it to master But Window Showed a popup that I have to enter Github Credentials (https://github.com). I did Signup with my Gmail account So I tried to enter my Gmail id along with its password, Obviously Git do not have my Gmail password and can't match it with what I'm providing, So I ended up canceling the push.
When I tried to sync my changes through GitHub GUI Window I encounter this error. On git status command Git Shell suggested to push changes as

Your branch is ahead of 'origin/master' by 1 commit.
  (use "git push" to publish your local commits)

I did the same as Git Shell suggested (git push) and everything is ok now.

Note: for someone who is new to git you have to change your path to the folder where your .git file is otherwise on Every Command you enter Git Shell will show error that its not a git repository.

fatal: Not a git repository (or any of the parent directories):

For example if your Project is in D drive in some folder you have to do something like below as you do in cmd to change directory.

cd D:\someFolder     // if your project is not deep in `D`

And if its within nested folder in D

cd D:\somefolder\someNestedFolder\nestedInNested     // if your project is not deep in `D`

If someone know how to login into Github popup from windows as I did signup with google account and here are 2 fields only Github username, password Please let me know. I have resolved the issue but with waste of some time so I want to know about login too.

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionNyxynyxView Question on Stackoverflow
Solution 1 - GitmanojldsView Answer on Stackoverflow
Solution 2 - GitNavin MishraView Answer on Stackoverflow
Solution 3 - Gitrk2View Answer on Stackoverflow
Solution 4 - GitrovsenView Answer on Stackoverflow
Solution 5 - GitTomView Answer on Stackoverflow
Solution 6 - GitkwakwaView Answer on Stackoverflow
Solution 7 - GitStevenView Answer on Stackoverflow
Solution 8 - GitRalph LavelleView Answer on Stackoverflow
Solution 9 - GitLibbyView Answer on Stackoverflow
Solution 10 - GitCoreyView Answer on Stackoverflow
Solution 11 - Gitmikii123View Answer on Stackoverflow
Solution 12 - GitAlex KonView Answer on Stackoverflow
Solution 13 - GitByron ClaiborneView Answer on Stackoverflow
Solution 14 - GitQasimView Answer on Stackoverflow
Solution 15 - GitStephen KearnsView Answer on Stackoverflow
Solution 16 - GitOpsimathView Answer on Stackoverflow
Solution 17 - GitInzimam Tariq ITView Answer on Stackoverflow