在远程服务器上我自己的私有仓库的 git clone 权限被拒绝 - 即使我添加了一个新的公钥和所有
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/14314158/
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
Permission denied on git clone of my own private repo on a remote server - even though I added a new public key and all
提问by dmonopoly
I have been setting up an instance of a server (Amazon EC2, Ubuntu 12.x), and have got stuck trying to clone my own private repo from git.
我一直在设置一个服务器实例(Amazon EC2、Ubuntu 12.x),但在尝试从 git 克隆我自己的私有存储库时遇到了困难。
I've been looking at https://help.github.com/articles/generating-ssh-keysand https://help.github.com/articles/error-permission-denied-publickeyfor a while, but still no good.
我一直在看https://help.github.com/articles/generating-ssh-keys和https://help.github.com/articles/error-permission-denied-publickey,但仍然没有好的。
I have generated a new ssh key pair on the remote machine with
我在远程机器上生成了一个新的 ssh 密钥对
ssh-keygen -t rsa -C "[email protected]"
and set up my git config fine, and I have added the public key to my github account. The email address is the same as the one I use on my local machine's ssh key (I don't know if that matters).
并设置好我的 git 配置,我已将公钥添加到我的 github 帐户中。电子邮件地址与我在本地机器的 ssh 密钥上使用的地址相同(我不知道这是否重要)。
After starting an ssh-agent and then doing ssh-add -l
, I get a fingerprint result that matches what is said in my github public key. ssh -T [email protected]
also tells me that I have successfully authenticated.
在启动 ssh-agent 然后执行 之后ssh-add -l
,我得到了一个指纹结果,它与我的 github 公钥中所说的相匹配。ssh -T [email protected]
还告诉我我已成功通过身份验证。
However, whenever I try
然而,每当我尝试
git clone https://github.com/dmonopoly/myprivateproject.git
or
或者
git clone [email protected]:dmonopoly/myprivateproject.git
on the remote machine (which I have sshed into), I get this error:
在远程机器(我已经进入)上,我收到这个错误:
fatal: could not create work tree dir 'myprivateproject'.: Permission denied
Ideas? I've handled the permission denied (public key)
before, but this seems different. Help appreciated.
想法?我以前处理permission denied (public key)
过,但这似乎不同。帮助表示赞赏。
回答by Jan Hudec
fatal: could not create work tree dir 'myprivateproject'.: Permission denied ^^^^^^^^^^^^^^^^^^^^
fatal: could not create work tree dir 'myprivateproject'.: Permission denied ^^^^^^^^^^^^^^^^^^^^
That has nothing at all to do with access to the repository. You are trying to clone it to a directory where you don't have write access. Check permissions on the machine running git clone
.
这与访问存储库完全无关。您正在尝试将其克隆到您没有写访问权限的目录。检查运行机器的git clone
权限。
回答by lschofield
sudo in front of the command took care of it for me. Easier than tracing the folder needing a permission change.
命令前面的 sudo 为我处理了它。比跟踪需要更改权限的文件夹更容易。