git clone ssh身份文件无法访问

git clone ssh身份文件无法访问

我正在使用 git.sh链接,我有密钥文件:

sh-3.2# ls -al /Users/tiina/.ssh/id_rsa/
drw-------  4 tiina  en   136 Jun 18 19:26 .
drwx------  5 tiina  en   170 Mar 15  2016 ..
-rw-------@ 1 tiina  en  1482 Jun 18 19:19 pri_rsa.ppk

但是当我在 Mac 上运行时

./git.sh -i ~/.ssh/id_rsa/pri_rsa.ppk clone ssh://[email protected]:2222/foo
Cloning into 'portal'...
Warning: Identity file /Users/tiina/.ssh/id_rsa/pri_rsa.ppk not accessible: Permission denied.
Load key "/Users/tiina/.ssh/id_rsa": Is a directory
Permission denied (publickey).
fatal: Could not read from remote repository.

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

编辑:事实证明我在这里犯了两个错误。在 mac 中使用 ssh 时,应先将私钥从 ppk 转换为 pem:

puttygen xxx.ppk -O private-openssh -o xxx.pem

(首先使用安装腻子sudo brew install putty

答案1

chmod u+x /Users/tiina/.ssh/id_rsa/

相关内容