Git Capistrano无法使用SSH提取存储库
我遵循了以下程序:Git Capistrano无法使用SSH提取存储库,git,ssh,capistrano,capistrano3,bitbucket-server,Git,Ssh,Capistrano,Capistrano3,Bitbucket Server,我遵循了以下程序: 创建SSH密钥 在Atlassian隐藏中启用SSH 为名为Capistrano的存储帐户添加了SSH密钥(Capistrano已使用用户名和密码成功连接到存储) 使用命令git clone测试SSH连接ssh://git@stash.domain.com:7999/project/repository.git,存储库已成功克隆 将Capistrano项目目录中的以下行更改为config/deploy.rb: set:repo\u url,'ssh://git@stash.
- 创建SSH密钥李>
- 在Atlassian隐藏中启用SSH李>
- 为名为Capistrano的存储帐户添加了SSH密钥(Capistrano已使用用户名和密码成功连接到存储)
- 使用命令git clone测试SSH连接ssh://git@stash.domain.com:7999/project/repository.git,存储库已成功克隆李>
- 将Capistrano项目目录中的以下行更改为
:config/deploy.rb
set:repo\u url,'ssh://git@stash.domain.com:7999/project/repository.git'
cap production git:check
I会得到以下错误行,部署被取消:
INFO [8b21e06e] Running /usr/bin/env mkdir -p /tmp/capistrano_project_name/ as deploy@host.domain.com
DEBUG [8b21e06e] Command: /usr/bin/env mkdir -p /tmp/capistrano_project_name/
INFO [8b21e06e] Finished in 0.292 seconds with exit status 0 (successful).
DEBUG Uploading /tmp/capistrano_project_name/git-ssh.sh 0.0%
INFO Uploading /tmp/capistrano_project_name/git-ssh.sh 100.0%
INFO [376577ce] Running /usr/bin/env chmod +x /tmp/capistrano_project_name/git-ssh.sh as deploy@host.domain.com
DEBUG [376577ce] Command: /usr/bin/env chmod +x /tmp/capistrano_project_name/git-ssh.sh
INFO [376577ce] Finished in 0.036 seconds with exit status 0 (successful).
INFO [2ed5c706] Running /usr/bin/env git ls-remote --heads ssh://git@stash.domain.com:7999/project/repository.git as deploy@host.domain.com
DEBUG [2ed5c706] Command: ( GIT_ASKPASS=/bin/echo GIT_SSH=/tmp/capistrano_project_name/git-ssh.sh /usr/bin/env git ls-remote --heads ssh://git@stash.domain.com:7999/project/repository.git )
DEBUG [2ed5c706] Permission denied (publickey).
DEBUG [2ed5c706] fatal: Could not read from remote repository.
DEBUG [2ed5c706]
DEBUG [2ed5c706] Please make sure you have the correct access rights
DEBUG [2ed5c706] and the repository exists.
(Backtrace restricted to imported tasks)
cap aborted!
Exception while executing as deploy@host.domain.com: git exit status: 128
git stdout: Nothing written
git stderr: Permission denied (publickey).
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
Tasks: TOP => git:check
(See full trace by running task with --trace)
我已经尝试简单地将变量更改为set:repo\u url,'ssh://git@stash.domain.com:7999/project/repository.git'
,但我收到了相同的错误。
有人通过SSH成功连接Capistrano到Stash吗?
你能建议我如何调试它吗?我希望避免在Capistrano配置文件中使用用户名和密码。这是一个过于简单的答案,但我猜Capistrano选择了错误的密钥。我建议您检查部署用户的默认ssh密钥。因此,如果capistrano设置为使用
deployuser
登录服务器,请查看deployuser
键拾取的内容。使用ssh-T进行测试会很有帮助git@stash.domain.com-p 7999
看看有什么结果。谢谢你的回答,@will。不幸的是,当我执行(用我的域更改字符串)命令ssh-T时git@stash.domain.com:7999
我回来了:ssh:无法解析主机名stash.domain.com:7999:名称或服务未知
而ping stash.domain.com
工作正常,我想这是因为端口号被附加到域中。谢谢,@will_in_wi。原因是我添加了部署管理计算机(源)的密钥而不是部署系统(目标)的密钥来隐藏,因此它没有拾取任何密钥。使用您的命令,我能够调试、在生产服务器中创建SSH密钥并将它们添加到存储中。