RE: fatal: The current branch master has no upstream branch. | and also 'https://gitbuh.com/MyName' #23239
-
Hello, I joined Github last week, created and initiated my first two repositories. Now I want to add, commit and push revised files to those repositories. When I pushed the revised files, I received the following response: ----------------------------------------- $ git push fatal: The current branch master has no upstream branch. To push the current branch and set the remote as upstream, use git push --set-upstream origin master ------------------------------------------ So I did, and received response: My Name@DESKTOP-32QET7M TINGS64 ~/Desktop (master) — (I revised this line, with same type of characters) $ git push --set-upstream origin master fatal: unable to access ‘https://gitbuh.com/AnneMarieHarm/deliverable_one.git/’: Could not resolve host: gitbuh.com ------------------------------------ I wonder how it became ‘gitbuh.com’ (not ‘github.com’)? And why I can’t seem to push revised files to my respositories? Any help anyone may be able to provide, would be appreciated. I’ve reviewed help files and references, and found this other user receiving some of the same responses (https://github.community/t5/How-to-use-Git-and-GitHub/Pushing-to-collaborator-s-private-repo-from-terminal/m-p/4170 VishAlSahim Ground Controller Lvl 1 02-23-2018 07:55 PM Message 1 of 2 Pushing to collaborator’s private repo from terminal: ) ------------------------------------------- However VishAlSahim’s situation seems more complex, as he is trying to collaborate by using or contributing to someone else’s repository. Thank you! |
Beta Was this translation helpful? Give feedback.
Replies: 17 comments
-
Hi @annemarieharm, you can ammend your remote URL with the following command:
|
Beta Was this translation helpful? Give feedback.
-
Hi strafe, I appreciate the reply; that is the same thing Stacey from Github Support recommended I do, with the addition of ‘.git’ at the end (in your case). I also see this referenced in the article she referred me to (https://help.github.com/articles/changing-a-remote-s-url/) – complete with .git at the end. However, this has not worked in my case; I’ve pasted recent results of that effort, below my signature. Any other options come to mind? Thank you. ~ Anne MarieAnne Marie Harm@DESKTOP-32QE01T MINGW64 ~/Desktop (master) Anne Marie Harm@DESKTOP-32QE01T MINGW64 ~/Desktop (master) git push --set-upstream origin master Anne Marie Harm@DESKTOP-32QE01T MINGW64 ~/Desktop (master) |
Beta Was this translation helpful? Give feedback.
-
Hi @annemarieharm, I’m glad your first issue is resolved. You can see the hints tell you there’s commits on the remote that you don’t have locally, this means it’s preventing you form pushing so you don’t erase those commits from the remote. Assuming there aren’t going to be any conflicts you should be able to use:
followed by:
|
Beta Was this translation helpful? Give feedback.
-
Hi strafe, Anne Marie Harm@DESKTOP-32QE01T MINGW64 ~/Desktop (master) Anne Marie Harm@DESKTOP-32QE01T MINGW64 ~/Desktop (master) git push --set-upstream origin masterI think next I’ll read up on doing a git pull, in case I haven’t done that correctly – and see what I find out. I do see that I may not have been in a good position to proceed to git push, from this message: From https://github.com/AnneMarieHarm/deliverable_one Thank you for your help. ~ Anne Marie |
Beta Was this translation helpful? Give feedback.
-
Hi Strafe, I am grateful for your responses; it now looks like the git remote set-url origin https://github.com/AnneMarieHarm/deliverable_one (with or without the .git file extension) resolved one of my issues (‘gitbuh.com’ typo). But it turns out while_ git pull_ may well also have allowed me to revise the files in question, I suspect it may have created others (and there was a simpler solution). Please let me know if you (or anyone else) would like further information. Either way I hope to remember these lessons, and all I learned by A) hearing back from you (and Stacey from Github Support), and B) reviewing and studying related documentation – how the issues I experienced compelled me to become more familiar. And how nice it was, when it finally worked! Thank you. ~ Anne Marie |
Beta Was this translation helpful? Give feedback.
-
Hi Anne Marie, I have the same problem and could not solve it!! Thanks for your answer!! |
Beta Was this translation helpful? Give feedback.
-
Hai Anne Marie. Currently I am facing the same problem with what you had. I could not push or pull and had the same messages. I was wondering if you could share the full solution? Thank you. |
Beta Was this translation helpful? Give feedback.
-
The problem is that you have to update your credential. When done updating your credential, use git push --set-upstream origin master for the first time after that you can use git push https://help.github.com/en/github/using-git/updating-credentials-from-the-osx-keychain |
Beta Was this translation helpful? Give feedback.
-
I appreciate the response, and love the fact that I’m receiving it almost a year and a half after posting my question. It testifies to a great reality of online user forums, and the way shared knowledge and experience accrue. Thank you! |
Beta Was this translation helpful? Give feedback.
-
You’re gonna hate me, but I solved it in a very ugly way. First, my context:
Solution: I edited .git/config and added the last three lines:
It’s working for me. If any of you want to yell at me, please go ahead, but from a safe social distance of 2 meters :slight_smile: |
Beta Was this translation helpful? Give feedback.
-
I realize it’s a figure of speech, but I’ll never hate you. Glad you’re out there, doing what you do! Thank you. |
Beta Was this translation helpful? Give feedback.
-
https://blog.google/technology/safety-security/expediting-changes-google-plus/ |
Beta Was this translation helpful? Give feedback.
-
Thx it seems it helped! |
Beta Was this translation helpful? Give feedback.
-
Had the same problem. How To Set Upstream Branch on Git – devconnectedComplete step-by-step tutorial on how to set upstream branches (remote tracking branches) on Git easily using branch commands. |
Beta Was this translation helpful? Give feedback.
-
Try this command works really well: |
Beta Was this translation helpful? Give feedback.
-
yup it’s works for me too. |
Beta Was this translation helpful? Give feedback.
-
Hello! that works for me! I didn’t know how to solve the problem, but git push origin master -f was the solution! Can you tell me why? I would like to know ! I am new to Git and GitHub. |
Beta Was this translation helpful? Give feedback.
Hi @annemarieharm, you can ammend your remote URL with the following command: