我承诺使用自己的git服务器并设置post-receive
挂钩:
#!/bin/sh
echo "Mirror to GitHub"
git push --mirror >>/tmp/git-push.log 2>&1 &
exec git update-server-info
这是/tmp/git-push.log
To github.com:honovation/ljmall.git
2127e2a15..9d8fb51e4 env-ljmall-staging -> env-ljmall-staging
To github.com:honovation/ljmall.git
! [remote rejected] env-ljmall-staging -> env-ljmall-staging (cannot lock ref 'refs/heads/env-ljmall-staging': is at 9d8fb51e482705480df71ebc378abb6a6eddca5a but expected 2127e2a157b32303d781401fa9694e5935660df2)
! [remote rejected] ljmall-staging-20180327102841-35b5a8283a20688ca12803980a92f17246ce6c7d -> ljmall-staging-20180327102841-35b5a8283a20688ca12803980a92f17246ce6c7d (failed)
error: failed to push some refs to 'git@github.com:honovation/ljmall.git'
我不知道为什么Github拒绝,前两行意味着github接受从env-ljmall-staging
到2127e2a15
的{{1}}更改,为什么Github期望旧的提交哈希({ {1}})?
答案 0 :(得分:0)
作为mentioned here,这可能是因为多个进程在您的服务器上同时运行,导致git
无法访问和锁定文件。
根据push --mirror
暗示push --force
无论如何,在您的回购中进行的任何修改/重置都不应该是一个问题。