【发布时间】:2013-11-27 16:03:30
【问题描述】:
我在 Atlassian Stash 的托管实例中有一个 git 存储库。然后我有三台机器:olympus、zeus 和 hera,我在其中部署了最新版本的软件系统。为了自动化这个,我想从 olympus 远程部署到我尝试使用 ssh 和 git pull 的其他机器上,但是 Permission denied (publickey). 失败了。我基本上做到了:
azg@olympus:~$ ssh azg@zeus 'cd ~/my/project/release/deploy/location/; git pull'
Permission denied (publickey).
fatal: The remote end hung up unexpectedly
我有以下几点:
- 每台机器都有不同的 azg 用户(没有时间安装 LDAP 等),所以我有 azg@olympus、azg@zeus 和 azg@hera。我为每个用户生成了 ssh id_rsa 密钥对。
- 我为每个 azg 用户
authorized_keys填充了其他用户的相应 id_rsa.pub -
Stash azg 用户为每个 azg 用户(azg@olympus、azg@zeus、azg@hera)配置了所有 id_rsa.pub 的副本,因此我可以通过 ssh 从每台机器克隆、拉取或推送,而无需输入每次都要密码。因此我不能做任何问题:
azg@olympus:~/code$ git clone ssh://azg@olympus:7999/pm/pm.git Cloning into 'pm'... remote: Counting objects: 555, done. remote: Compressing objects: 100% (271/271), done. remote: Total 555 (delta 203), reused 555 (delta 203) Receiving objects: 100% (555/555), 9.54 MiB, done. Resolving deltas: 100% (203/203), done.
我可以在每台机器上分别做同样的事情。但是,如果我先远程登录,即每次都要求我输入密钥“/home/azg/.ssh/id_rsa”的密码,例如
azg@olympus:~$ ssh azg@zeus
Welcome to Ubuntu 12.04.3 LTS (GNU/Linux 3.5.0-43-generic x86_64)
* Documentation: https://help.ubuntu.com/
Last login: Wed Nov 27 17:01:33 2013 from olympus
azg@zeus:~$ cdc
azg@zeus:~/code$ git clone ssh://azg@olympus:7999/pm/pm.git
Cloning into 'pm'...
Enter passphrase for key '/home/azg/.ssh/id_rsa': <<<<<<<<<<< WHY???
remote: Counting objects: 555, done.
remote: Compressing objects: 100% (271/271), done.
remote: Total 555 (delta 203), reused 555 (delta 203)
Receiving objects: 100% (555/555), 9.54 MiB | 145 KiB/s, done.
Resolving deltas: 100% (203/203), done.
【问题讨论】:
标签: git ubuntu ssh bitbucket-server