我正在使用git进行版本控制,我想让git自动将任何协作者在release分支上推送的所有内容自动拉到远程服务器上,如果我想通过ssh执行此操作,我必须将所有协作者的ssh密钥添加到我的服务器中,但我不想让他们访问服务器,所以我想将这个git挂钩设置为HTTP,这样每个人都可以通过HTTP协议推送到远程服务器
到目前为止,我所做的是设置一个git挂钩,我使用Nginx作为web服务,并且我已经将git存储库放在
/var/www/html/test_repo我把我的git遥控器设置在本地计算机上,如下所示:
git remote add test http://ServerIp/test_repo但是它给了我这个错误:
fatal: repository 'http://ServerIp/test_repo/' not found发布于 2017-07-30 23:31:58
您需要让您的NGiNX调用/usr/lib/git-core/git-http-backend,以便让git正确响应克隆/拉入命令。
例如,参见this answer:最好在URL路径中设置一个文件夹来跟踪git repos。
listen 80;
server_name myhostname;
access_log /var/log/nginx/git.access.log;
error_log /var/log/nginx/git.error.log;
gzip off;
location ~ /git(/.*) {
...
}因此,即使fastcgi_param GIT_PROJECT_ROOT参数为/var/www/html,git存储库的URL也是http://ServerIp/git/test_repo
https://stackoverflow.com/questions/45398341
复制相似问题