Github Windows 'Failed to sync this branch'

巧了我就是萌 提交于 2020-01-28 13:16:08

问题


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

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.


回答1:


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.




回答2:


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.




回答3:


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.




回答4:


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.




回答5:


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%



回答6:


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.




回答7:


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%



回答8:


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.




回答9:


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.




回答10:


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.




回答11:


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.




回答12:


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.




回答13:


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.




回答14:


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.




回答15:


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)




回答16:


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.




回答17:


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.



来源:https://stackoverflow.com/questions/15387640/github-windows-failed-to-sync-this-branch

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!