我正在配置我的git仓库在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;
}
}
我将我的存储库根目录设置为
/var/www/git/repos
。在其中,我使用命令git --bare init firstrepo.git
初始化了我的裸库,例如/var/www/git/repos/firstrepo.git/
。Git clone工作正常,但是当我进行更改并执行
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文件,但是没有帮助。错误仍然存在。
在我的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"
在我的错误日志中
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"
receive-pack
。 - Derek Mahar