git push to nginx git-http-backend:error:无法访问URL http返回码22致命:git-http-push failed
内容导读
互联网集市收集整理的这篇技术教程文章主要介绍了git push to nginx git-http-backend:error:无法访问URL http返回码22致命:git-http-push failed,小编现在分享给大家,供广大互联网技能从业者学习和参考。文章包含3733字,纯文字阅读大概需要6分钟。
内容图文
![git push to nginx git-http-backend:error:无法访问URL http返回码22致命:git-http-push failed](/upload/InfoBanner/zyjiaocheng/967/f062c76778c54ed1a2606c4c5f5a301e.jpg)
我正在配置我的git repos以在Ubuntu 14.04中使用http服务(使用nginx / 1.4.6 git-http-backend fastcgi:fcgiwrap 1.1.0-2).但抓住了以下错误.
# git push origin master
Username for 'http://server.com': git
Password for 'http://git@gittest.cloudthis.com':
error: Cannot access URL http://server.com/rahul.git/, return code 22
fatal: git-http-push failed
我的nginx网站的配置如下.
server {
listen 80;
server_name server.com;
root /var/www/git/repos;
include /etc/nginx/fcgiwrap.conf; # Added as a support for cgi
auth_basic "Welcome to my GIT repos"; # Added for Basic Auth +1
auth_basic_user_file /etc/apache2/.htpasswd;
location ~ /git(/.*) {
# location /repos/ {
#client_max_body_size 0;
include /etc/nginx/fastcgi_params;
fastcgi_param SCRIPT_FILENAME /usr/lib/git-core/git-http-backend;
fastcgi_param GIT_HTTP_EXPORT_ALL true;
fastcgi_param GIT_PROJECT_ROOT /var/www/git/repos;
fastcgi_param PATH_INFO $uri;
fastcgi_param REQUEST_METHOD $request_method;
fastcgi_param REMOTE_USER $remote_user;
fastcgi_pass unix:/var/run/fcgiwrap.socket;
}
}
我有我的repos根目录为/ var / www / git / repos.我使用命令git –bare init firstrepo.git初始化了我的裸存储库,如/var/www/git/repos/firstrepo.git/
Git克隆工作正常,但是当我进行更改并执行git push origin master时,它会给出错误
# touch newfile
# git add newfile
# git commit -m " commited "
[master 059714a] commited
1 file changed, 0 insertions(+), 0 deletions(-)
create mode 100644 newfile
# git push origin master
Username for 'http://server.com': git
Password for 'http://git@server.com':
error: Cannot access URL http://server.com/rahul.git/, return code 22
fatal: git-http-push failed
任何人都知道我做错了什么.还尝试编辑.git / config文件,如here所述
,但它没有帮助.错误保持不变
在我的access.log中
114.143.99.83 - - [14/Aug/2014:15:49:33 +0000] "GET /rahul.git/info/refs?service=git-receive-pack HTTP/1.1" 401 203 "-" "git/1.9.1"
114.143.99.83 - - [14/Aug/2014:15:49:36 +0000] "GET /rahul.git/info/refs?service=git-receive-pack HTTP/1.1" 401 203 "-" "git/1.9.1"
114.143.99.83 - git [14/Aug/2014:15:49:36 +0000] "GET /rahul.git/info/refs?service=git-receive-pack HTTP/1.1" 200 59 "-" "git/1.9.1"
114.143.99.83 - git [14/Aug/2014:15:49:36 +0000] "GET /rahul.git/HEAD HTTP/1.1" 200 23 "-" "git/1.9.1"
114.143.99.83 - - [14/Aug/2014:15:49:37 +0000] "PROPFIND /rahul.git/ HTTP/1.1" 401 203 "-" "git/1.9.1"
在我的error.log中
2014/08/14 15:49:33 [error] 2872#0: *19 no user/password was provided for basic authentication, client: 114.143.99.83, server: server.com, request: "GET /rahul.git/info/refs?service=git-receive-pack HTTP/1.1", host: "server.com"
2014/08/14 15:49:36 [error] 2872#0: *20 no user/password was provided for basic authentication, client: 114.143.99.83, server: server.com, request: "GET /rahul.git/info/refs?service=git-receive-pack HTTP/1.1", host: "server.com"
2014/08/14 15:49:37 [error] 2872#0: *21 no user/password was provided for basic authentication, client: 114.143.99.83, server: server.com, request: "PROPFIND /rahul.git/ HTTP/1.1", host: "server.com"
解决方法:
作为described by Marcs,您可以通过启用receivepack选项解决您的身份验证问题,但是这个disables the requirement for authentication.您更希望的是与git-http-backend进行通信,哪个用户已成功通过身份验证.这可以通过将REMOTE_USER FastCGI参数设置为$remote_user Nginx variable来完成.
server {
...
location ... {
auth_basic "Restricted";
auth_basic_user_file /path/to/.htpasswd;
fastcgi_param REMOTE_USER $remote_user;
...
}
}
考虑到您当前的Nginx配置,您可能还会遇到与fcgiwrap的连接过早关闭的问题,这与order of FastCGI parameters matter有关.如果/ etc / nginx / fastcgi_params包含例如: SCRIPT_FILENAME,使用fcgiwrap时不会被/usr/lib / git-core / git-http-backend覆盖.
内容总结
以上是互联网集市为您收集整理的git push to nginx git-http-backend:error:无法访问URL http返回码22致命:git-http-push failed全部内容,希望文章能够帮你解决git push to nginx git-http-backend:error:无法访问URL http返回码22致命:git-http-push failed所遇到的程序开发问题。 如果觉得互联网集市技术教程内容还不错,欢迎将互联网集市网站推荐给程序员好友。
内容备注
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 gblab@vip.qq.com 举报,一经查实,本站将立刻删除。
内容手机端
扫描二维码推送至手机访问。