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

(先使用 putty 安裝sudo brew install putty

答案1

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

相關內容