我通过Nginx + Unicorn使用Gitlab 7。一旦启用HTTP基本身份验证,git命令(如“git push”或“git pull”)停止工作。没有HTTP基本认证所有工作正常。我如何解决它?我需要启用HTTP基本身份验证,而不会对开发人员造成任何损害。 我的nginx的conf文件为gitlab:通过HTTP的Git命令基本身份验证
upstream gitlab {
server unix:/home/git/gitlab/tmp/sockets/gitlab.socket;
}
server {
listen *:80 default_server;
server_name gitlab.delfit.com;
server_tokens off;
root /home/git/gitlab/public;
client_max_body_size 300m;
# individual nginx logs for this gitlab vhost
access_log /var/log/nginx/gitlab_access.log;
error_log /var/log/nginx/gitlab_error.log;
location/{
# serve static files from defined root folder;.
# @gitlab is a named location for the upstream fallback, see below
try_files $uri $uri/index.html $uri.html @gitlab;
}
# if a file, which is not found in the root folder is requested,
# then the proxy pass the request to the upsteam (gitlab unicorn)
location @gitlab {
proxy_read_timeout 300;
proxy_connect_timeout 300;
proxy_redirect off;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header Host $http_host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
# auth_basic "Restricted";
# auth_basic_user_file /home/git/gitlab/.htpasswd;
proxy_pass http://gitlab;
}
error_page 502 /502.html;
}
启用基本身份验证后的错误是:
[email protected]:~/git/myproject$ git push
fatal: Authentication failed for 'http://gitlab.myorg.com/user/repo.git'
提前感谢!
你使用的是什么版本的'git'?用'git --version'获取它。当使用git将/ push到gitlab时,我面临一些问题<1.7.10 – PierreF