我最近从svn转换过来的。我的服务器在Windows下(别怪我,这不是我的选择:}
我已经创建了一个包含两个分支"master“和”稳定“的repo。
在我的服务器上,我想从稳定分支获取文件。
我已经做到了:
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上是什么……
发布于 2011-06-09 09:55:40
几点:
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添加到path并开始使用它。
#!/bin/sh才能让钩子正常运行。
post-merge钩子。当您推送到远程存储库时,post-receive和post-update会在它们上运行。发布于 2011-06-09 09:21:21
git可能是实际可执行文件的批处理包装器。使用call git pull。
而且这些钩子只有在从远程位置推送内容时才会触发,据我从文档中可以看出。所以它们在pull中被忽略了。
https://stackoverflow.com/questions/6286982
复制相似问题