[英]Commit to repo on production after Capistrano deploy
For obscure, painful operational reasons, production code needs to check code into the main Git repo. 由于晦涩难懂的操作原因,生产代码需要将代码检入主Git存储库中。
However, Capistrano 3, on deploy, does: 但是,Capistrano 3在部署时会:
execute :git, :clone, '--mirror', repo_url, repo_path
The --mirror
option, implies --bare
, which creates the directory structure without the .git
meta data. --mirror
选项隐含--bare
,它创建目录结构而没有.git
元数据。
Is there a way to override this in Capistrano 3? 在Capistrano 3中有没有方法可以覆盖此问题?
Since you are committing code from the production (which is usually a strict no - you should create a patch
from the diff
, and apply it locally and then do a push), I assume you already have access to your production server. 由于您要从生产中提交代码(通常严格禁止-您应从diff
创建patch
,然后在本地应用它,然后进行推送),因此我假设您已经可以访问生产服务器。
This is a soultion outside the Capistrano framework. 这是Capistrano框架之外的灵魂。 You need to do the following: 您需要执行以下操作:
http(s)
url here (because otherwise you might have to set up ssh keys) 在此处使用http(s)
url(因为否则可能需要设置ssh密钥) However, I would recommend creating a patch and applying it as follows: 但是,我建议创建补丁并将其应用如下:
git diff > diff.patch.date
使用git diff > diff.patch.date
创建所有现有文件的diff文件 scp server/path/to/diff.patch.date local/path/to/repo
使用scp server/path/to/diff.patch.date local/path/to/repo
将此补丁文件复制到本地系统之一 git apply diff.patch.date
使用git apply diff.patch.date
来git apply diff.patch.date
git add . && git commit -m "msg"
使用git add . && git commit -m "msg"
添加并提交更改git add . && git commit -m "msg"
git add . && git commit -m "msg"
EDIT 编辑
After re-reading your question, it seems that Capistrano is creating a bare repo, and hence you are unable to make the commits from there. 重新阅读您的问题后,Capistrano似乎正在创建裸仓库,因此您无法从那里进行提交。 If that is the case, 如果是这样,
git clone original_bare_rep non_bare_repo
只需使用git clone original_bare_rep non_bare_repo
制作另一个非裸露的git clone original_bare_rep non_bare_repo
git remote add upstream url/to/repo/hosting
使用git remote add upstream url/to/repo/hosting
gitlab / bitbucket url等添加为git remote add upstream url/to/repo/hosting
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.