我通過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