fatal: The current branch master has no upstream branch

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 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 tried it and got this:

  • Revert a merge after being pushed
  • git gc --aggressive push to server?
  • Can Travis-CI test diff instead of all files?
  • Github repo name and local folder name for repo
  • Use Xcode 4 as Git difftool
  • Make Git “LF will be replaced by CRLF” warnings go away
  • peeplesoft@jane3:~/846156 (master) $ git push --set-upstream origin master
    fatal: Authentication failed

    Another stackoverflow thread suggested I try the following, with disappointing results.

    peeplesoft@jane3:~/846156 (master) $ git push -u origin master
    fatal: Authentication failed

    Then I tried this:

    peeplesoft@jane3:~/846156 (master) $ git config remote.origin.push HEAD
    peeplesoft@jane3:~/846156 (master) $ git push
    fatal: Authentication failed

    Any hints?

  • How to apply/use Perl::Tidy with an existing Perl project?
  • Git branches and creation of new files
  • Untrack and stop tracking files in git
  • Move specific git commit from master to branch
  • How do I clone a GitHub wiki?
  • Git command to show which specific files are ignored by .gitignore
  • 6 Solutions collect form web for “fatal: The current branch master has no upstream branch”

    You fixed the push, but, independently of that push issue (which I explained in “Why do I need to explicitly push a new branch?”), you need now to resolve the authentication issue.

    That depends on your url (ssh as in ‘git@github.com/yourRepo, or https as in https://github.com/You/YourRepo)

    For https url:

    If your account is protected by the two-factor authentication, your regular password won’t work (for https url), as explained here or here.

    Same problem if your password contains special character (as in this answer)

    If https doesn’t work (because you don’t want to generate a secondary key, a PAT: personal Access Token), then you can switch to ssh, as I have shown here.

    Also you can use the following command:

    git push -u origin master

    This creates (-u) another branch in your remote repo. Once the authentication using ssh is done that is.

    Apparently you also get this error message when you forget the --all parameter when pushing for the first time. I wrote

    git push -u origin

    which gave this error, it should have been

    git push -u origin --all

    Oh how I love these copy-paste errors …

    First use git pull origin your_branch_name
    Then use git push origin your_branch_name

    You need to configure the remote first, then push.

    git remote add origin url-to-your-repo

    Actual Instructions

    1 A computer and your github associated. Use SSH. Computer code so you do not need to submit verified enter image description here

    2 git can not manage empty folder. So you have to write such a readme.md saved in a file. Otherwise you will not find the file.

    3 Your local project is nothing new projects move over. Please git init – -git remote add origin +”githublink”-git add . – Git commit -m “” go again.

    4 then “git pull origin master” (the key)

    5 At last git push origin master (solve all problem).

    http://my.oschina.net/psuyun/blog/123005 参考链接

    Git Baby is a git and github fan, let's start git clone.