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

谢谢
三通

设置为

自动转发推送的存储库可以使用更新后。 我会对自行启动推送的 repo 非常谨慎,因为至少在推送的引用上变基和重置一个 Jekyll-and-Hyde 数字,从非常有用的操作变成令人担忧和脆弱的操作。

最新更新