在Ruby-on-Rails项目的capistrano部署中,部署失败并因致命错误而中止。消息是
A branch named 'deploy' already exists.
当然分支已经存在,因为我们正在尝试部署该分支。知道出了什么问题吗?这是日志,我们使用Git,capistrano分支设置为deploy
,capistrano版本设置为2.15.9
,ruby版本为2.3.1
$ cap staging deploy
triggering load callbacks
* 2016-09-13 12:12:38 executing `staging'
triggering start callbacks for `deploy'
* 2016-09-13 12:12:38 executing `multistage:ensure'
* 2016-09-13 12:12:38 executing `deploy'
* 2016-09-13 12:12:38 executing `deploy:update'
** transaction: start
* 2016-09-13 12:12:38 executing `deploy:update_code'
executing locally: "git ls-remote git@git.my-company.com:developer-group/my-site.git deploy"
command finished in 615ms
* executing "git clone -q -b deploy --depth 1 git@git.my-company.com:developer-group/my-site.git /home/my-user/sites/my-domain.de/releases/20160913101239 && cd /home/my-user/sites/my-domain.de/releases/20160913101239 && git checkout -q -b deploy fe7bd80727d9cce1a275a531c6e21b84e15ab0cd && rm -Rf /home/my-user/sites/my-domain.de/releases/20160913101239/.git && (echo fe7bd80727d9cce1a275a531c6e21b84e15ab0cd > /home/my-user/sites/my-domain.de/releases/20160913101239/REVISION)"
servers: ["my-server"]
[my-server] executing command
** [my-server :: err] fatal: A branch named 'deploy' already exists.
command finished in 2481ms
失败的命令是git checkout -q -b deploy sha_value
。
答案 0 :(得分:2)
事实证明 deploy 是Capistrano的保留名称,因此不允许您将其用作分支名称。如果部署Git项目,Capistrano显然会尝试创建一个临时的“部署”分支。 https://github.com/capistrano/capistrano/issues/359
一般来说,“部署”,“医生”和“安装”都是Capistrano中的保留名称,也不允许作为阶段名称(例如“生产”或“分期”)。