自动推送“构建分支”使用“git archive”后没有本地仓库
我正在 git 存储库上设置自动构建。我想从主分支自动构建版本——我正在使用“git archive”来构建沙箱——并且,根据构建是否成功,我想将“构建分支”推送到成功构建的版本。
这个想法是,“build”分支始终可以从 master 访问,也就是说,它将始终从“build”快进到“master”,所以我不会创建任何对象,甚至不会提交对象,我只是将“ref”从一个已经存在的提交对象移动到另一个已经存在的提交对象。
我使用 git archive 的原因是在构建时正确应用属性“export-ignore”和“export-subst”。
所以,总结一下这个问题:
有没有一种方法可以将远程 git 存储库中的引用更新为远程端已经存在的提交,而无需对其进行克隆?
丹尼尔
I am setting up a automated build on top of a git repository. I want to automatically build versions from the master branch -- I'm using "git archive" to a build sandbox -- and, depending whether the build succeeds, I want to push a "build branch" to the version that succeeded building.
The idea is that the "build" branch will always be reachable from master, that is, it will always be a fast-forward from "build" to "master", so I'm not creating any objects, not even commit objects, I'm just moving a "ref" from one already-existing to another already-existing commit object.
The reason I'm using git archive is to have the attributes "export-ignore" and "export-subst" properly applied when building.
So, summarizing the question:
Is there a way to update a ref in a remote git repository -- to a commit that is already on the remote side -- without having a clone of it?
daniel
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您正在构建的地方已经有了它的克隆。只需简单地按下 HEAD:master 即可。还可以考虑标记来标记您的成功构建。
更新:
当您将某些内容推送到远程时,Git 总是需要发送对象。如果你没有物体,你就无法推动。也就是说,您可以通过将提交的 SHA1 放到共享目录来实现自动化,并在另一台计算机上使用存储库的克隆将该引用推送到分支中。
希望有一些低级命令可以直接执行此操作,或者有一种方法来欺骗它,但我还没有看到。
You will already have a clone of it where you are building. A simple push of HEAD:master is all you need. Also consider tagging instead to mark your successful builds.
UPDATE:
Git is something that will always need to send objects when you push something to a remote. If you don't have the objects you can't push. That said, you could automate via a drop to a shared dir the SHA1 of the commit and have a process on that other machine with a clone of the repo push that reference into the branch.
Hopefully there are some low level commands that can do this directly, or a way to trick it, but I haven't seen that yet.