我试图把我的一个项目推到github,我一直得到这个错误:

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

所以我试了一下,得到了这个:

peeplesoft@jane3:~/846156 (master) $ git push --set-upstream origin master

fatal: Authentication failed

另一个stackoverflow线程建议我尝试以下方法,但结果令人失望。

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

fatal: Authentication failed

然后我试了一下:

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

peeplesoft@jane3:~/846156 (master) $ git push

fatal: Authentication failed

有提示吗?


当前回答

对我来说,问题来自我的分支名称:“#name-of-my-branch”,没有“#”也可以!

其他回答

我在上传的时候也遇到了同样的问题,我解决了 做着上面说的同样的事情: 早些时候,我试图通过https将终端推送到linux中的存储库 就像

git push https://github.com/SiddharthChoudhary/ClientServerCloudComputing.git

但没有任何结果,因此我更深入地尝试:

git push --set-upstream https://github.com/SiddharthChoudhary/ClientServerCloudComputing.git master

这招奏效了。这样就会提示您输入用户名和密码。 我还生成了一个令牌,而不是密码,我粘贴令牌,因此,成功完成。

要生成一个令牌,请转到您的Github帐户,在开发者设置中,然后创建另一个令牌。 收到后,收到 该令牌并在被询问时粘贴到密码提示中。

这是更好的,克隆这个回购新的。也许它只是迷失了方向。

遇到了几乎相同的问题,但不是来自主分支。 我尝试推两个(2)分支到我的远程存储库,通过使用$ git push命令;不幸地抛出了:

fatal: The current branch <branch-name> has no upstream branch. To push the current branch and set the remote as upstream, use

 git push --set-upstream origin <branch-name>

我用下面的命令修复了它:

$ git push -u origin --all

PS:这里提供的解决方案应该,我相信,让git更容易远程跟踪分支;有一天,当处理有几个分支的项目时,这可能会派上用场。

1. 一台电脑和你的github相关联。使用SSH。计算机代码,所以你不需要提交验证输入图像说明这里

2. Git不能管理空文件夹。所以你必须写一份自述书。Md保存在一个文件中。否则您将找不到该文件。

3.您本地的项目并不是新的项目。请

git init

Git远程添加origin +“githublink”

转到添加 。

Git commit -m "" go again。

4. 然后git拉origin master(键)

5. 最后git push origin master(解决所有问题)。

http://my.oschina.net/psuyun/blog/123005 reference link

如果你在任何分支上,你可以使用这个:

git push origin head -u

这将自动在远程上创建同名的新分支。