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:
- merging the changes from two repositories in github
- Syncing remote fork with remote master
- No such file or directory - git ls-files — WINDOWS
- Github Dual Authorship one Developer
- How to make sure teammates don't screw up the git repo by rewriting history?
- Icons on Git Files in local machine
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
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 ‘
email@example.com/yourRepo, or https as in
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 …
git pull origin your_branch_name
use git push origin your_branch_name
You need to configure the remote first, then push.
git remote add origin url-to-your-repo
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).