我试图把我的一个项目推到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

有提示吗?


当前回答

我有同样的问题,原因是我忘记指定分支

git push myorigin feature/23082018_my-feature_eb

其他回答

首先使用git拉原点your_branch_name 然后使用git push origin your_branch_name

在我的情况下,我有一个本地分支称为Master,而Master是在Github上。 我只是把我的Master ->重命名为Master,然后签出为Master。 然后按一下。这对我很管用。

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

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

我得到这个错误是因为我试图在没有写权限的情况下推送代码,我只有读权限。 在Bitbucket中,当你打开你的repo(存储库详细信息)时,你可以在右侧检查访问: