Git hook - 本地机器到远程服务器钩子脚本

时间:2013-10-08 00:13:40

标签: git

我在Mac上,我正在尝试创建一个工作流程来改善我的流程 所以我只是在我自己的机器上安装了git 我现在遇到的问题是如何创建更新后的挂钩以将我在本地进行的更改推送到我的远程服务器? 注意:git服务器位于我的本地计算机上,因此无法从托管服务器访问 有很多不同的钩子,更新后的钩子甚至是正确的钩子我应该这样做吗?

这是我到目前为止所做的,但它现在正在创建一个错误。

# trying to get a list of files that I just pushed to my local git server, but it is failing because apparently 'diff-index' isn't available on the server side of git
files_modified=`git diff-index --name-only HEAD`

for f in $files_modified; do
  # trying to print out the files.
  # the goal here is I'm trying to execute 'scp' to push the files to the server, but please let me know if there is a better solution
  echo f
done

exit

谢谢你,
三通

1 个答案:

答案 0 :(得分:1)

设置为自动转发推送的存储库可以使用更新后。我非常怀念一个自己推销的回购,因为至少rebase和reset在推出的refs上做了一个Jekyll-and-Hyde数字,从非常有用的操作转变为充满冲击和脆弱的操作。