我正在gitosis为中央存储库编写post-push hook
它将更新从中央存储库提取到测试环境
nano /var/git/repositories/holding.git/hooks/post-update
#!/bin/bash
cd /var/vh/holding;
git reset --hard;
git checkout testing;
git pull;
Run Code Online (Sandbox Code Playgroud)
这是我在推送客户端后获得的(开发虚拟机)
# blah ...
Counting objects: 57, done.
Compressing objects: 100% (24/24), done.
Writing objects: 100% (30/30), 3.42 KiB, done.
Total 30 (delta 18), reused 0 (delta 0)
fatal: Not a git repository: '.'
fatal: Not a git repository: '.'
fatal: Not a git repository: '.'
fatal: Not a git repository: '.'
To git@cheby.ru:holding.git
233b5a2..0f46cd8 testing -> testing
Run Code Online (Sandbox Code Playgroud)
显然,我试图告诉git,它应该在哪里拉动,但失败了.
在bash脚本中为指定的工作副本运行git命令的正确方法是什么?
env -i
Run Code Online (Sandbox Code Playgroud)
例如,为了确保没有副作用GIT_DIR,可以预先设置环境变量.
(env -i或简单地:unset GIT_DIR)
| 归档时间: |
|
| 查看次数: |
17053 次 |
| 最近记录: |