致命的:当前分支主机没有上游分支 [英] fatal: The current branch master has no upstream branch

查看:4370
本文介绍了致命的:当前分支主机没有上游分支的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我尝试将我的一个项目推送到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,如' git@github.com/yourRepo 或https,如 https:/ /github.com/You/YourRepo



对于https url:



如果您的帐户受双重身份验证的保护,您的常规密码将获得不工作(用于https网址),如此处所述 或在这里

如果您的密码包含特殊字符(如此答案

a>)



如果https不起作用(因为您不想生成辅助密钥,即PAT:个人访问令牌),那么您可以切换到ssh,正如我在这里展示的


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 '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.

这篇关于致命的:当前分支主机没有上游分支的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆