使用 Bitbucket 部署 Capistrano
Capistrano deployment with Bitbucket
当我尝试执行 Capistrano 部署脚本以从 bitbucket.org 部署我的项目时,它在执行以下命令时失败
$ RBENV_ROOT=/path/to/.rbenv RBENV_VERSION=2.1.5 GIT_ASKPASS=/bin/echo GIT_SSH=/tmp/appname/git-ssh.sh /usr/bin/env git ls-remote --heads git@bitbucket.org:username/project.git
但是当我通过 ssh 进入部署机器并手动执行时,同样的命令工作正常
Capistrano 跟踪:
** Execute git:check
INFO [f938a643] Running /usr/bin/env git ls-remote --heads git@131.103.20.167:username/project.git on 172.10.0.111
DEBUG [f938a643] Command: ( RBENV_ROOT=/path/to/.rbenv RBENV_VERSION=2.1.5 GIT_ASKPASS=/bin/echo GIT_SSH=/tmp/project/git-ssh.sh /usr/bin/env git ls-remote --heads git@bitbucket.org:username/project.git )
DEBUG [f938a643] conq: repository access denied.
DEBUG [f938a643] fatal: Could not read from remote repository.
DEBUG [f938a643]
DEBUG [f938a643] Please make sure you have the correct access rights
DEBUG [f938a643] and the repository exists.
cap aborted!
部署服务器输出:
$ RBENV_ROOT=/path/to/.rbenv RBENV_VERSION=2.1.5 GIT_ASKPASS=/bin/echo GIT_SSH=/tmp/appname/git-ssh.sh /usr/bin/env git ls-remote --heads git@bitbucket.org:username/project.git
ee4088b33b5151536d9783c80c40eec3f48f86df refs/heads/master
这通常表示 SSH 密钥问题。确保您与 BitBucket 关联的私钥在 ~/.ssh/id_(dsa|rsa)
中并且是 chmod 600.
当我尝试执行 Capistrano 部署脚本以从 bitbucket.org 部署我的项目时,它在执行以下命令时失败
$ RBENV_ROOT=/path/to/.rbenv RBENV_VERSION=2.1.5 GIT_ASKPASS=/bin/echo GIT_SSH=/tmp/appname/git-ssh.sh /usr/bin/env git ls-remote --heads git@bitbucket.org:username/project.git
但是当我通过 ssh 进入部署机器并手动执行时,同样的命令工作正常
Capistrano 跟踪:
** Execute git:check
INFO [f938a643] Running /usr/bin/env git ls-remote --heads git@131.103.20.167:username/project.git on 172.10.0.111
DEBUG [f938a643] Command: ( RBENV_ROOT=/path/to/.rbenv RBENV_VERSION=2.1.5 GIT_ASKPASS=/bin/echo GIT_SSH=/tmp/project/git-ssh.sh /usr/bin/env git ls-remote --heads git@bitbucket.org:username/project.git )
DEBUG [f938a643] conq: repository access denied.
DEBUG [f938a643] fatal: Could not read from remote repository.
DEBUG [f938a643]
DEBUG [f938a643] Please make sure you have the correct access rights
DEBUG [f938a643] and the repository exists.
cap aborted!
部署服务器输出:
$ RBENV_ROOT=/path/to/.rbenv RBENV_VERSION=2.1.5 GIT_ASKPASS=/bin/echo GIT_SSH=/tmp/appname/git-ssh.sh /usr/bin/env git ls-remote --heads git@bitbucket.org:username/project.git
ee4088b33b5151536d9783c80c40eec3f48f86df refs/heads/master
这通常表示 SSH 密钥问题。确保您与 BitBucket 关联的私钥在 ~/.ssh/id_(dsa|rsa)
中并且是 chmod 600.