Github "Failed to publish this branch" error on windows

In Windows, right click on your repository --> click on open a shell here

You will see a command prompt.

type git push in it. (been aware after seeing SimonBoudrias comment)

The command prompt will suggest you to type some other command or shows an error.

If the command prompt suggest you to type something else, then type that. It will work.
If the command prompt shows error then please post the detailed error here.

Info: You might want to check this app


Open a shell in your repository. Then type

git push --set-upstream origin master --force

This will upload your local repo to the server no matter what, overwriting if necessary. This should only be done if you're sure nobody else is publishing to your repo at the moment.


I had the same issue as mentioned here, but none of the solutions mentioned above helped. Then I found this answer which talks about Proxy settings, which is exactly why GitHub was failing to commit on my machine. Hope this helps somebody else

To set up your Proxy Settings, you just need to use this command:

git config --global http.proxy http[s]://userName:password@proxyaddress:port


To fix it, open a command prompt in the repo. For example by pressing the cog in the top right in the repo view and selecting "open a shell here".

  • In the command prompt, type git push --set-upstream origin master

  • Either this will work, or it will say ! [rejected] master -> master (fetch first)

  • If this happens, type git pull origin master (add --rebase if you like)

In GitHub the Publish-button might still be visible instead of the sync button. If this is the case, simply restart GitHub.

What this does is resetting the default remote branch for your local branch to master.


Maybe you just forget type something to the Description area when you commit your files. Someone like me only type the summery.So make sure you have fill in the Summary and Description when you commmit.

Just type something to the Description textarea when commiting. Then i published successfully.

what i do? 1 Go to the folder of your repository in Windows Explorer 2 delete the file your want to publish. and recreat it. 3 Open GitHub For Windows and click on your Repository .then you will find Uncommitted changes on left side.
4 type your Summary 5 type your Description.(the most important step !!!) 6 commit to master 7 Hit Publish and You should be successful.

This is my first answer. so i have no 10 reputation to post an image......hope help you.