Saya mencoba men-setup server di mana git repo saya dapat diakses dengan HTTP (S).
Saya menggunakan gitolite dan nginx (dan gitlab untuk antarmuka web tapi saya ragu itu ada bedanya).
Saya telah mencari sepanjang sore dan saya pikir saya terjebak.
Saya pikir saya sudah mengerti bahwa nginx membutuhkan fcgiwrap untuk bekerja dengan gitolite, jadi saya mencoba beberapa konfigurasi, tetapi tidak ada yang berfungsi.
Repositori saya ada di / home / git / repositori.
Inilah tiga konfigurasi nginx yang telah saya coba.
1:
location ~ /git(/.*) {
gzip off;
root /usr/lib/git-core;
fastcgi_pass unix:/var/run/fcgiwrap.socket;
include /etc/nginx/fcgiwrap.conf;
fastcgi_param SCRIPT_FILENAME /usr/lib/git-core/git-http-backend;
fastcgi_param DOCUMENT_ROOT /usr/lib/git-core/;
fastcgi_param SCRIPT_NAME git-http-backend;
fastcgi_param GIT_HTTP_EXPORT_ALL "";
fastcgi_param GIT_PROJECT_ROOT /home/git/repositories;
fastcgi_param PATH_INFO $1;
#fastcgi_param PATH_TRANSLATED $document_root$fastcgi_path_info;
}
Hasil:
> git clone http://myservername/projectname.git test/
Cloning into test...
fatal: http://myservername/projectname.git/info/refs not found: did you run git update-server-info on the server?
dan
> git clone http://myservername/git/projectname.git test/
Cloning into test...
error: The requested URL returned error: 502 while accessing http://myservername/git/projectname.git/info/refs
fatal: HTTP request failed
2:
location ~ /git(/.*) {
fastcgi_pass localhost:9001;
include /etc/nginx/fcgiwrap.conf;
fastcgi_param SCRIPT_FILENAME /usr/lib/git-core/git-http-backend;
fastcgi_param GIT_HTTP_EXPORT_ALL "";
fastcgi_param GIT_PROJECT_ROOT /home/git/repositories;
fastcgi_param PATH_INFO $1;
}
Hasil:
> git clone http://myservername/projectname.git test/
Cloning into test...
fatal: http://myservername/projectname.git/info/refs not found: did you run git update-server-info on the server?
dan
> git clone http://myservername/git/projectname.git test/
Cloning into test...
error: The requested URL returned error: 502 while accessing http://myservername/git/projectname.git/info/refs
fatal: HTTP request failed
3:
location ~ ^.*\.git/objects/([0-9a-f]+/[0-9a-f]+|pack/pack-[0-9a-f]+.(pack|idx))$ {
root /home/git/repositories/;
}
location ~ ^.*\.git/(HEAD|info/refs|objects/info/.*|git-(upload|receive)-pack)$ {
root /home/git/repositories;
fastcgi_pass unix:/var/run/fcgiwrap.socket;
fastcgi_param SCRIPT_FILENAME /usr/lib/git-core/git-http-backend;
fastcgi_param PATH_INFO $uri;
fastcgi_param GIT_PROJECT_ROOT /home/git/repositories;
include /etc/nginx/fcgiwrap.conf;
}
Hasil:
> git clone http://myservername/projectname.git test/
Cloning into test...
error: The requested URL returned error: 502 while accessing http://myservername/projectname.git/info/refs
fatal: HTTP request failed
dan
> git clone http://myservername/git/projectname.git test/
Cloning into test...
error: The requested URL returned error: 502 while accessing http://myservername/git/projectname.git/info/refs
fatal: HTTP request failed
Juga perhatikan bahwa dengan salah satu dari konfigurasi tersebut, ketika saya mencoba untuk mengkloning dengan nama proyek yang sebenarnya tidak ada, saya mendapatkan kesalahan 502.
Apakah ada yang sudah berhasil melakukan ini? Apa yang saya lakukan salah?
Terima kasih.
MEMPERBARUI:
file log kesalahan nginx berkata:
2012/04/05 17:34:50 [crit] 21335#0: *50 connect() to unix:/var/run/fcgiwrap.socket failed (13: Permission denied) while connecting to upstream, client: 192.168.12.201, server: myservername, request: "GET /git/oct_editor.git/info/refs HTTP/1.1", upstream: "fastcgi://unix:/var/run/fcgiwrap.socket:", host: "myservername"
Jadi saya mengubah izin untuk /var/run/fcgiwrap.socket, dan sekarang saya punya:
> git clone http://myservername/git/projectname.git test/
Cloning into test...
error: The requested URL returned error: 403 while accessing http://myservername/git/projectname.git/info/refs
fatal: HTTP request failed
Ini file error.log yang saya miliki sekarang:
2012/04/05 17:36:52 [error] 21335#0: *78 FastCGI sent in stderr: "Cannot chdir to script directory (/usr/lib/git-core/git/projectname.git/info)" while reading response header from upstream, client: 192.168.12.201, server: myservername, request: "GET /git/projectname.git/info/refs HTTP/1.1", upstream: "fastcgi://unix:/var/run/fcgiwrap.socket:", host: "myservername"
Saya terus menyelidiki.
/usr/lib/git-core/git/projectname.git/info
?