[zuqqhi2@local]
$git clone http://git.example.com/repositories/test.git
$cd test
$vim README
push from local
$git commit -m "first push from local" -a
$git push origin master
OK!うまく行った!
gitweb
最後はgitwebをインストールするだけだ。
gitwebのインストール
apt-get installで大丈夫。
[ubuntu@remote]
$sudo apt-get install gitweb
gitweb.confの設定
gitwebの設定をする。
[ubuntu@remote]
$sudo vim /etc/gitweb.conf
# path to git projects (<project>.git)
$projectroot = "/home/git/repositories";
# directory to use for temp files
$git_temp = "/tmp";
# target of the home link on top of all pages
#$home_link = $my_uri || "/";
# html text to include at home page
#$home_text = "indextext.html";
# file with project list; by default, simply scan the projectroot dir.
#$projects_list = $projectroot;
# stylesheet to use
@stylesheets = ("static/gitweb.css");
# javascript code for gitweb
$javascript = "static/gitweb.js";
# logo to use
$logo = "static/git-logo.png";
# the 'favicon'
$favicon = "static/git-favicon.png";
# git-diff-tree(1) options to use for generated patches
#@diff_opts = ("-M");
@diff_opts = ();
nginxの設定
gitweb.cgi用のnginx設定をする。
[ubuntu@remote]
$sudo vim /etc/nginx/sites-available/git
server {
listen 80 default_server;
listen [::]:80 default_server ipv6only=on;
root /home/git;
index index.html index.htm;
access_log /home/git/logs/access.log;
error_log /home/git/logs/error.log;
# Make site accessible from http://localhost/
server_name git.example.com;
location /repositories {
auth_basic "Restricted";
auth_basic_user_file /etc/nginx/htpasswds/git;
include /etc/nginx/fcgi_params;
fastcgi_param SCRIPT_FILENAME /usr/lib/git-core/git-http-backend;
fastcgi_param GIT_PROJECT_ROOT /home/git;
fastcgi_param GIT_HTTP_EXPORT_ALL "";
fastcgi_param PATH_INFO $uri;
fastcgi_param REMOTE_USER $remote_user;
fastcgi_pass unix:/var/run/fcgiwrap.socket;
}
location /gitweb {
auth_basic "Restricted";
auth_basic_user_file /etc/nginx/htpasswds/git;
index index.cgi;
include /etc/nginx/fcgi_params;
gzip off;
if ($uri ~ "/gitweb/index.cgi") {
fastcgi_pass unix:/var/run/fcgiwrap.socket;
}
}
error_page 404 /404.html;
error_page 500 502 503 504 /50x.html;
}