所以需要在~/.ssh/config動手腳。
原先:
$ vi ~/.ssh/configHost 155.100.xxx.xxx
Hostname 155.100.xxx.xxx
User ex1_user
IdentityFile ~/.ssh/ex1.pem
Host 155.100.xxx.xxx
Hostname 155.100.xxx.xxx
User ex1_user
IdentityFile ~/.ssh/ex2.pem
$ git clone ex1@155.100.xxx.xxx:proj_1
success
$ git clone ex1@155.100.xxx.xxx:proj_2
Cloning into 'fs/server/warinode'...
FATAL: R any fs/server/warinode fttwsmt DENIED by fallthru
(or you mis-spelled the reponame)
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
會發現第二個無法正常clone
修改後:
下方紅色字體為增加內容。$ sudo chmod 400 ~/.ssh/ex1.pem
$ sudo chmod 400 ~/.ssh/ex2.pem
$ vi ~/.ssh/config
Host ex1 155.100.xxx.xxx
Hostname 155.100.xxx.xxx
User ex1_user
IdentityFile ~/.ssh/ex1.pem
Host ex2 155.100.xxx.xxx
Hostname 155.100.xxx.xxx
User ex1_user
IdentityFile ~/.ssh/ex2.pem
$ git clone ex1@ex1:proj_1
success
$ git clone ex1@ex2:proj_2
success