如何修复“无法锁定引用” Capistrano在服务器上部署时出错? [英] How to fix "cannot lock ref" error while deploying on server using capistrano?
问题描述
我试图将修补程序部署到我的登台服务器(DigitalOcean),但出现无法锁定引用错误。我以前偶然发现了这个错误。我有一个分支 hotfix,然后创建了 hotfix / some-hotfix分支,当我尝试将其推送到原始位置时,出现了错误。我通过删除存储库(BitBucket)中的分支修补程序来解决此问题。但是现在我在临时服务器上部署时得到了它。
I was trying to deploy a hotfix to my staging server (DigitalOcean) but got a "cannot lock ref" error. I stumbled on this error before. I had a branch 'hotfix' and then I created 'hotfix/some-hotfix' branch and when I tried to push it to origin I got the error. I fixed it by deleting branch 'hotfix' in my repository (BitBucket). But now I am getting it while deploying on staging server.
堆栈跟踪:
SSHKit::Command::Failed: git exit status: 1
git stdout: Fetching origin
error: cannot lock ref 'refs/heads/hotfix/my-hotfix-branch-name': 'refs/heads/hotfix' exists; cannot create 'refs/heads/hotfix/my-hotfix-branch-name'
From bitbucket.org:username/repo-name
! [new branch] hotfix/my-hotfix-branch-name -> hotfix/my-hotfix-branch-name (unable to update local ref)
error: some local refs could not be updated; try running
'git remote prune origin' to remove any old, conflicting branches
error: Could not fetch origin
git stderr: Nothing written
我尝试运行 git远程修剪起源
,但没有帮助。
我对此一无所知
I tried running git remote prune origin
but it didn't help.
I'm stuck with no ideas here
推荐答案
我能够解决此问题:
-
ssh
到您的服务器。 - 查找
/ repo /
文件夹(我在部署的应用程序文件夹〜/ apps / app-name / repo
中找到我的文件夹)和cd
放入其中。 - 运行
git远程修剪源
。
ssh
to your server.- Find
/repo/
folder (I got mine in my deployed application folder~/apps/app-name/repo
) andcd
into it. - Run
git remote prune origin
.
完成此步骤后,我便可以将其部署到服务器上。
After making this steps I was able to deploy to my server.
这篇关于如何修复“无法锁定引用” Capistrano在服务器上部署时出错?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!