Github "Failed to publish this branch" error on windows - windows

I'm new to git, and I just downloaded it yesterday. As a test for my first online (not local) repo, I committed a useless text file and then hit publish. After a short while, I got this very non-descriptive error:
So I know that I can't publish to this branch. There's only one and it's the master branch. Does anyone have any further information on what might be causing this error?
As a side note, my partner has successfully uploaded files to the same repo, but I haven't gotten any sort of indication that this has happened. Does this mean I'm not connected to the repo properly in some way? I was the one who set it up!

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.

Another possibility is a temporary unavailability of GitHub servers.
I'm just having the same problem and confirmed that it's a server issue: https://status.github.com/
Sample screenshot:

I had this error since I forgot to add remote repository link in the GitHub desktop. Once added the correct repo link, everything worked.

Try to commit your changes before publishing. It helps me to solve same problem.

I too had the same problem while publishing my GitHub page. I solved it in the following way.
$git push
I got the error message here. Then I made a pull request
$git pull
After this I made the push again
$git push
Here I got the solution
Note:I use GitHub for windows,And finally published the page using it

I was getting that error because I hadn't properly configured my name and email. On the page where you do that (in the native app, at least), you'll see that the page opens with your name and email already filled in but that doesn't mean that they're saved as settings. In order to save them, you have to press the check mark in the bottom left corner of that screen.

I got this error because I already had created a repository with the same name on github, and then created it locally and tried to commit it. The solution was to delete it from github, then commit it from the local client. Now they're in sync.

Related

Issue with pushing my changes to my repository

I have just set up my computer with a clean install. My project code etc was already on a secondary D drive so is unaffected.
I installed Git and TortoiseGit.
I now try to do a Push and get an error about a UriFormatException. Then it shows the password window:
I can log into my repositories OK on BitBucket web page. So what have I done wrong?
The whole point is that yesterday I was able to communicate these repositories with bitbucket.
Now I can't. ChuckieAJ is correct.
But something is wrong on my setup of TortoiseGit etc.
All I know is that I can no longer push anything to my bitbucket account. It is all messed up. :(
This helped me out:
https://help.cloudforge.com/hc/en-us/articles/215243143-Configure-TortoiseGIT-client-to-work-with-SSH-keys-on-Windows?mobile_site=true
I had to click on Git / Remote in each repository and correct the URL links to the new SSH locations and use the new Putty Key path.
Probably, ChuckieAJ should not be part of the url -- at least not with ChuckieAJ# in front of it but probably with bitbucket.org/ChuckieAJ/yourproject or something.

How to revert xcode pull request?

This is my problem and i tried to look solution, didn't find anything related to me.
created new project 1 —> and pushed to github.com (this project is dummy has no code)
created new project 2 —> wrote code and tried pushing to github.com with remote link to project 1 it gave me an error stating to 1st use pull the request. I did pull request.
now the project 2 became empty (which took 2 days to code) is there any option to get back my code?
That is a very strange situation. You shouldn't have been able to do what you describe.
Simulating what you describe in Xcode 8.0, I get a The remote repository could no be found - make sure a valid repository exists at the specified location and try again. message, because the projects are different.
Maybe something else happened.
Nevertheless, may this be a lesson to you. Commit locally first and then to the remote. You can do both, one after the other, with one operation in Xcode, by checking the Push to Remote box in the commit screen. That way you would still have your local code. ;-)

git permission denied on pull/push

I'm trying to create a project using git, but after cloning repository from github in phpstorm i can commint/push/pull only once. After that I see the message about permissions denied on files: COMMIT_EDITMSG or FETCH_HEAD.
I set .git folder visible and not only readable and i can do one commit/push/pull and after permissions denied again. And .git folder become hidden and only readable.
In windows I set full access for .git folder and it files, but got same effect.
Cloning through phpstorm or console have no difference.
ps: Sorry for my english. And some names and title maybe not correct because I have russian windows.
pps: i've scanned my PC and found no viruses.
You can't push to other people's repositories unless they give you permission.
If you want to push the code back to github, fork it first on github, then do a "git clone" with the URL of your own fork, not the original repository.
You should then be able to do pushes to your fork.
Make sure you have configured your public SSH key(s) in the github account settings.
After pushing your changes to your fork, you can do a pull request on github so the original project can merge your changes into their repository.
I had a similar problem. First i tried identified myself in IDEA Jetbrains via userName / password and Test Connection confirmed the correctness of my input. But the comit and the push, etc. only worked with other applications. Not with Jetbrains. but now i used token variant. and that works. :)
https://youtrack.jetbrains.com/oauth?state=%2Fissue%2FWI-41232

XCode Source Control status constantly refreshing

I'm running XCode 6.1 and working with a git repo. XCode's source control is turned on, as well as the options Refresh local status automatically and Refresh server status automatically and Add or remove files automatically.
Every 10 seconds or so, xcode shows every file's status as changing to unknown (a question mark). After a bit, they mostly all refresh and show the correct status. This keeps happening over and over.
Why is this happening and how can I stop it?
They look like so:
Question Marks
Normal
Finally I have found the cause of this problem, and thus the solution.
My git repo was checked out on my local machine inside of another git repo by accident. Doing this cause massive confusion to XCode, apparently. Doing a fresh checkout in a different folder fixed the problem.
To resolve this you need to do the following:
Go to Source Control -> Refresh Status.
It should solve your problem.

github for windows crashing several times a day

I newly started working on Github via their native Windows Application, it's quite good however it's crashing so often and the horrible thing is that I lose all the recent changes after it's crashing. All the local files will rollback to the last version of the successful commit or sync.
I'm on a 64bit windows 8 machine. Any ideas?
The exact error after crash is Couldn't find a HEAD in this repository
I sent an email to GitHub For Windows support. Their answer was this:
Hi David,
I am sorry for the trouble.
I have been able to reproduce this problem, and have filed a report for our developers to look at. The reason the application is crashing is likely due to merge conflicts between the local and remote repositories.
The easiest way to resolve this would be to go into the repository that is saying 'failed looking for HEAD', closing that pop-up, and clicking Tools -> Open a Shell Here.
From the shell, you can run 'git reset --merge' to undo the merge that caused GitHub for Windows to crash.
From there, run 'git checkout master' to switch from the detached HEAD.
After that, run 'git pull' in the shell to pull down any new changes. It will prompt you to fix any merge conflicts (which is what caused the app to crash).
Once you fix the merge conflicts in the files, you should then be able to sync correctly in GitHub for WIndows.
I have been testing this issue, and after I resolved the conflicts with the initial crash, I no longer had any further trouble with GitHub for Windows. It correctly prompted me to open the shell and resolve merge conflicts rather than crashing.
Let me know if you have any further questions, and hopefully we will have a fix out for this soon.
Best,
Steve
This is the solution I received from Github support. I'll copy & paste the exact text here:
The easiest way to resolve this would be to go into the repository that is saying 'failed looking for HEAD', closing that pop-up, and clicking Tools -> Open a Shell Here. From the shell, you can run 'git reset --merge' to undo the merge that caused GitHub for Windows to crash. After that, run 'git pull' in the shell to pull down any changes. It will prompt you to fix any merge conflicts. Once you fix the merge conflicts in the files, you should then be able to sync correctly in GitHub for WIndows.
I have been testing this issue, and after I resolved the conflicts with the initial crash, I no longer had any further trouble with GitHub for Windows. It correctly prompted me to open the shell and resolve merge conflicts rather than crashing.
I had this problem after I made an unstable change to my .gitconfig user file.
I only detected the issue after I tried using TortoiseGIT and it outlined the error parsting the config file with an unexpected token.
So the fix was to correct the bad .gitconfig file.

Resources