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:

  • Is there a git revert similar to svn revert? I need a single command to erase *everything* in my local and set it to remote head
  • Is it good to commit files often if using Mercurial or Git?
  • git flow branching model branching
  • How do I use IntelliJ with Subversion, Git and “git-svn”
  • How to create tag with forward slash in its name
  • How to make my local git copy always at its latest version automatically?
  • 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 use multiple Git SSH keys on Eclipse?
  • git clone: warning: --depth is ignored in local clones; use file:// instead
  • Hosting Private Git repos on my own server?
  • Deploying with github, git_discovery_across_filesystem not set
  • .gitmodules changes with multiple git users, causing a constant headache
  • Don't working the library from GitHub in Android Studio
  • 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.