我最近从 svn 转换过来。
我的服务器在 Windows 下(别怪我,这不是我的选择:}
我创建了一个具有两个分支“master”和“stable”的存储库。
在我的服务器上,我想从稳定分支获取文件。
我已经做好了:
git clone git://url/.git src
cd src
git checkout --track -b stable origin/stable
以前我有一个 .bat 脚本
cd my_repo_dir
svn update
echo APPLICATION_STAGE = 'production' > conf\__init__.py
net stop apache2.2
net start apache2.2
现在用 git 就可以了
cd my_repo_dir
git pull
echo APPLICATION_STAGE = 'production' > conf\__init__.py
net stop apache2.2
net start apache2.2
git pull 之后什么都没有执行,无论它是成功的还是最新的。
它只是退出提示而没有任何警告。
我想到了钩子。
我创造了:
.git/hooks/post-receive
.git/hooks/post-update
两个文件具有相同的内容:
echo APPLICATION_STAGE = 'production' > conf\__init__.py
net stop apache2.2
net start apache2.2
不,它也没有执行......
也许我缺少解释的声明行(*nix 上的 #!/bin/sh)
但我不确定它在windows上是什么......
几点:
-
确保路径上有 git.exe。做一个where git
你必须得到类似的东西
C:\Program Files (x86)\Git\bin\git.exe
如果正在使用 git.cmd (来自 C:\Program Files (x86)\Git\cmd\git.cmd ),你必须这样做call git pull
让它继续执行。我会说添加git.exe
路径并开始使用它。
即使在 Windows 上,您也必须拥有 shebang -#!/bin/sh
以使挂钩正常运行。
如果您希望挂钩在拉动时运行,您可能需要使用post-merge
hook. post-receive
and post-update
当您推送到远程存储库时,在远程存储库上运行。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)