[英]git sudo user access denied
In my ternimal when I run 当我奔跑的时候
git clone -q git@codebasehq.com:zzzz/yyyy/plat.git
I am able to clone the project but if I run 我可以克隆项目,但是如果我运行
sudo git clone -q git@codebasehq.com:zzzz/yyyy/plat.git
and give the correct password I get 并输入正确的密码
Permission denied (publickey).
fatal: The remote end hung up unexpectedly
any idea why is this ? 知道为什么吗?
Your root user just don't have the right public key in /root/.ssh
. 你的root用户只是没有在正确的公钥 /root/.ssh
。
Your user surely has one in ~/.ssh
, but root does not. 您的用户肯定在~/.ssh
有一个,但root没有。
codebasehq使用公用/专用密钥对进行身份验证,因此在sudo时,您尝试使用root的密钥对进行身份验证,这与您的密钥对不同。
I think its really simple. 我认为这很简单。
When you run the git clone with sudo you run it under the root user. 使用sudo运行git clone时 ,可以在root用户下运行它。 And i think your root user has no valid public key to clone the repo. 而且我认为您的root用户没有有效的公共密钥来克隆存储库。
There are some methods to enable only the key authentification. 有一些方法仅启用密钥验证。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.