问题描述
我尝试将我的一个项目推送到github,并且一直出现此错误:
peeplesoft @ jane3 :〜/ 846156(master)$ git push
致命:当前分支主机没有上游分支。
要推送当前分支并将远程设置为上游,请使用
$ b git push --set-upstream origin master
所以我试了一下,得到了这个:
peeplesoft @ jane3:〜 / 846156(master)$ git push --set-upstream origin master
致命:身份验证失败
另一个stackoverflow线程建议我尝试以下,结果令人失望。
peeplesoft @ jane3:〜/ 846156 (master)$ git push -u origin master
致命:认证失败
然后我试过这个:
$ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $
peeplesoft @ jane3:〜/ 846156(master)$ git push
致命:身份验证失败
任何提示?
问题(我解释过在: git push -u origin master
或 git push -u origin --all
),您现在需要解决身份验证问题。
这取决于您的url(ssh,如' [email protected]/yourRepo
或https,如 https:/ /github.com/You/YourRepo
)
对于https url:
如果您的帐户受的保护,您的常规密码将获得不工作(用于https网址), 。
如果您的密码包含特殊字符(如。
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:
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?
You fixed the push, but, independently of that push issue (which I explained in "Why do I need to explicitly push a new branch?": git push -u origin master
or git push -u origin --all
), you need now to resolve the authentication issue.
That depends on your url (ssh as in '[email protected]/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.
这篇关于致命的:当前分支主机没有上游分支的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!