fatal: The current branch master has no upstream branch

后端 未结 23 2216
误落风尘
误落风尘 2020-11-30 16:46

I\'m trying to push one of my projects to github, and I keep getting this error:

peeplesoft@jane3:~/846156 (master) $ git push

fatal: The current branch mas         


        
相关标签:
23条回答
  • 2020-11-30 17:11

    For me, I was pushing the changes to a private repo to which I didn't had the write access. Make sure you have the valid access rights while performing push or pull operations.

    You can directly verify via

    0 讨论(0)
  • 2020-11-30 17:15

    Well, I was having the same trouble while uploading and I resolved it by doing the same thing which it says to do: Earlier I was trying to push through terminal to my repository in linux by https like

    git push https://github.com/SiddharthChoudhary/ClientServerCloudComputing.git
    

    But was not getting any result and hence I went down deeper and tried:

    git push --set-upstream https://github.com/SiddharthChoudhary/ClientServerCloudComputing.git master
    

    And it worked. Thus then you will get prompted with username and password. I also generated a token and instead of Password I pasted the token and thus, being done successfully.

    1. To generate a token go to your Github account and in Developer Settings and then create another token.
    2. After getting that, copy that token and paste in the password prompt when it's been asked.
    0 讨论(0)
  • 2020-11-30 17:17

    You need to configure the remote first, then push.

    git remote add origin url-to-your-repo
    

    Actual Instructions

    0 讨论(0)
  • 2020-11-30 17:17

    Please try this scenario

    git push -f --set-upstream origin master
    
    0 讨论(0)
  • If you are on any branch, you can use this:

    git push origin head -u
    

    This will automatically create new branch of the same name on the remote.

    0 讨论(0)
提交回复
热议问题