GIT 推送问题:请确保您拥有正确的访问权限
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/22167920/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
GIT push issue: please make sure you have the correct access rights
提问by callmeben
I can clone the code from git server, but I can not push my code.
我可以从 git 服务器克隆代码,但我无法推送我的代码。
I prepare to push the code.
我准备推送代码。
First, I execute the command git add
, it's OK;
首先我执行命令git add
,没问题;
Second, I execute the command git commit
, it's OK;
第二,我执行命令git commit
,没问题;
Third,I execute the command git push
, the screen prints the information
三、我执行命令git push
,屏幕打印信息
fatal:upload denied for project '------'
fatal:could not read from remote repository
please make sure you have the correct access rights.
Addition, there is no file "know_hosts" in the folder ".ssh".
此外,文件夹“.ssh”中没有文件“know_hosts”。
How can I resolve the question?
我该如何解决这个问题?
Thanks very much!
非常感谢!
回答by dnl-blkv
When you are doing git add
, you are modifying the local repository, as well as in git commit
case.
当您这样做时git add
,您正在修改本地存储库,以及git commit
以防万一。
On the other hand, when you are doing git push
, you are trying to push from your local repository to the remote one.
另一方面,当您执行 时git push
,您正试图从本地存储库推送到远程存储库。
In your case, the most possible reason is that you just really have not got required access rights. According to mine experience, that could occur because of three main reasons:
在您的情况下,最可能的原因是您确实没有获得所需的访问权限。根据我的经验,这可能是由于三个主要原因:
1) You are pushing to a wrong repository (check its URL).
1)您推送到错误的存储库(检查其 URL)。
2) You are using SSH without the SSH-key properly set on both sides (private key on your PC and public on your account in the hub you are using).
2) 您在使用 SSH 时没有在双方正确设置 SSH 密钥(您的 PC 上的私钥和您正在使用的集线器中的帐户上的公共密钥)。
3) You are using HTTPS, but mistyping your credentials on the authorization stage.
3) 您正在使用 HTTPS,但在授权阶段输入了错误的凭据。
If the data is not critical, try checking URL and using insecure HTTP. If it works, then check your SSH keys / credentials. Otherwise, check the URL one more time.
如果数据不重要,请尝试检查 URL 并使用不安全的 HTTP。如果有效,请检查您的 SSH 密钥/凭据。否则,再检查一次 URL。
Hope that helps!
希望有帮助!
Here is a good source on GIT-related information: Git for beginners: The definitive practical guide
这是 GIT 相关信息的一个很好的来源:Git 初学者:权威实用指南