无法将git local master推送到远程存储库

时间:2017-10-03 12:55:41

标签: git repository git-remote

我只是想将我的本地主服务器推送到github上的远程存储库,但这是不可能的。我已经在我的github目录中创建了一个存储库 - 在网站上,我正在处理的应用程序非常简单,因为我只处理本地主服务器 - 没有分支或任何东西。

当我在终端尝试'git push -u origin master'时,回复是:

permission denied (publickey)
fatal: could not read from remote repository

当我尝试'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'

但是当我尝试'git push --set-upstream origin master'时,我得到了:

Permission denied (publickey).
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

我一直在网上阅读这个,但我无法到达任何地方,所以一些建议将非常感谢,谢谢: - )

2 个答案:

答案 0 :(得分:0)

- 如果你想更新分支---

git checkout master

git pull origin master

git checkout YOUR-BRANCH

git rebase master

- 如果你想提交代码---

git add -A

git commit -m "any comment"

git push origin YOUR-BRANCH

git checkout master

git pull origin master

git checkout YOUR-BRANCH

git rebase master

最后

git push origin YOUR BRANCH

并在您提交合并请求后

答案 1 :(得分:0)

您可能无权从创建的存储库中读取或写入。您需要生成一个新的SSH密钥并将公钥添加到您的Github帐户。如果您不知道如何操作,请在https://help.github.com/articles/connecting-to-github-with-ssh/上详细说明。

相关问题