[git] Github Windows 'Failed to sync this branch'

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.

This question is related to git github github-for-windows

The answer is


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.


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.


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.


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%

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.


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.


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.


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.


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.


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.


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%

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)


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.


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.


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.


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.


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.


Examples related to git

Does the target directory for a git clone have to match the repo name? Git fatal: protocol 'https' is not supported Git is not working after macOS Update (xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools) git clone: Authentication failed for <URL> destination path already exists and is not an empty directory SSL_connect: SSL_ERROR_SYSCALL in connection to github.com:443 GitLab remote: HTTP Basic: Access denied and fatal Authentication How can I switch to another branch in git? VS 2017 Git Local Commit DB.lock error on every commit How to remove an unpushed outgoing commit in Visual Studio?

Examples related to github

Does the target directory for a git clone have to match the repo name? Issue in installing php7.2-mcrypt How can I switch to another branch in git? How to draw checkbox or tick mark in GitHub Markdown table? How to add a new project to Github using VS Code git clone error: RPC failed; curl 56 OpenSSL SSL_read: SSL_ERROR_SYSCALL, errno 10054 How to add empty spaces into MD markdown readme on GitHub? key_load_public: invalid format git - remote add origin vs remote set-url origin Cloning specific branch

Examples related to github-for-windows

Git: Installing Git in PATH with GitHub client for Windows I can't find my git.exe file in my Github folder Github Windows 'Failed to sync this branch' Where is git.exe located? Change Git repository directory location.