CentOSã«gitosiså ¥ãã¦gitwebãããåç §åºæ¥ãããã«
ä»ã¾ã§svn使ã£ã¦ããã©ããããgitã«ç§»è¡ããªãããªã£ã¦æã£ããã©gitã£ã¦æ¥ç¶æã«ãã¹ã¯ã¼ãã¨ããã¹ãã¬ã¼ãºã¨ãæ±ãããããããªãªã¢ã¼ããã¹ãã¨ã®æ¥ç¶ã¯é£ãããã§ãããã ããã¨è¨ã£ã¦ã¯ã©ã¤ã¢ã³ãèªè¨¼ããªãã®ã¯ã»ãã¥ãªãã£çã«ã©ã¼ã ã¨ãã§ã¨æã£ã¦ãã¨gitosisã£ã¦ãã¼ã«ã使ãã°ã¯ã©ã¤ã¢ã³ãã®å ¬ééµãäºããµã¼ãå´ã«ç»é²ãã¦ããäºã§ã¦ã¼ã¶ã®èå¥ãå¯è½ãªãããgitosisã使ã£ã¦ç®¡çããåããã¸ã§ã¯ãã®è¨å®ãgitã§ç®¡çããã£ã¦ã®ã¯ã¡ãã£ã¨é¢ç½ãã
CentOSçã®å ´åãyumçã®ããã±ã¼ã¸ã¤ã³ã¹ãã¼ã«ã³ãã³ãã«Gité¢é£ãå«ã¾ãã¦ããªãå ´åãããã
ãã®çºã以ä¸ã®ã³ãã³ãã§fedoraç¨ã®ããã±ã¼ã¸ãCentOSã§ãå©ç¨å¯è½ã«ããã
rpm -Uvh http://download.fedora.redhat.com/pub/epel/5/i386/epel-release-5-3.noarch.rpm
Gitã®ã¤ã³ã¹ãã¼ã«
yum install git-core
gitosisã®ã¤ã³ã¹ãã¼ã«
yum install gitosis
gitã¦ã¼ã¶ã®è¿½å ã¨ãã¹ã¯ã¼ãã®è¨å®
useradd -g root gitosis
passwd gitosis
â»ä»åã¯èªåã§ã¦ã¼ã¶"gitosis"ãã°ã«ã¼ã"gitosis"ãä½æãããã®ã§ãã¡ãã使ç¨ã
gitosisã®åæå
sudo -H -u gitosis gitosis-init < /root/.ssh/id_rsa.pub
gitosisã®åæè¨å®
mkdir /root/gitwork cd /root/gitwork git clone [email protected]:gitosis-admin.git
gitosisã®ã¦ã¼ã¶è¿½å
cd /root/gitwork/gitosis-admin
ã/root/gitwork/gitosis-admin/gitosis.confããã¡ã¤ã«ãç·¨é
[gitosis] [group gitosis-admin] writable = gitosis-admin members = [email protected] user-name@host-name
追å 対象ã¦ã¼ã¶ã®å
¬ééµã管çãã£ã¬ã¯ããªä»¥ä¸ã«ã³ãã¼ï¼è¿½å 対象ã¯ã©ã¤ã¢ã³ãä¸ã§ã®æä½ï¼
sudo scp ~/.ssh/id_rsa.pub [email protected]:/root/gitwork/gitosis-admin/keydir/[email protected]
å¤æ´åãcommit&push
git add -u && git add . git commit -av git push
gitwebã®ã¤ã³ã¹ãã¼ã«
yum install gitweb
ãã¼ãã£ã«ãã¹ãã®è¨å®ã/etc/httpd/conf.d/vhosts.confãã®ç·¨é
<VirtualHost *:80> ServerAdmin [email protected] ServerName git.your-domain.com SetEnv GITWEB_CONFIG /var/lib/gitosis/gitosis/gitweb.conf Alias /gitweb.css /var/lib/gitosis/gitweb.css Alias /git-logo.png /var/lib/gitosis/git-logo.png Alias /git-favicon.png /var/lib/gitosis/git-favicon.png ScriptAlias /cgi-bin /var/lib/gitosis DocumentRoot /var/lib/gitosis/repositories <Directory /var/lib/gitosis/repositories> Options Indexes FollowSymlinks ExecCGI AllowOverride None Order allow,deny Allow from all DirectoryIndex /cgi-bin/gitweb.cgi RewriteEngine On RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^.* /cgi-bin/gitweb.cgi/$0 [L,PT] </Directory> LogLevel debug ErrorLog logs/git.your-domain.com-error_log CustomLog logs/git.your-domain.com-access_log common </VirtualHost>
gitwebã®å®è¡ãã¡ã¤ã«çãgitosisã®ãã¼ã ãã£ã¬ã¯ããªä»¥ä¸ã«ã³ãã¼
cp /var/www/git/* /var/lib/gitosis/
åç
§å¶éã®çºãã¼ã·ãã¯èªè¨¼è¨å®
htpasswd -c /var/lib/gitosis/.htpasswd root
ãã¡ã¤ã«ã/var/lib/gitosis/.htaccessããç·¨éï¼ä½æï¼
AuthUserFile /var/lib/gitosis/.htpasswd
AuthGroupFile /dev/null
AuthName "Please enter your ID and password"
AuthType Basic
require valid-user
gitwebã®è¨å®ãã¡ã¤ã«ãã³ãã¼
cp /usr/share/doc/gitosis-0.2/gitweb.conf /var/lib/gitosis/gitosis/
ã/var/lib/gitosis/gitosis/gitweb.confããç·¨é
# Include the global configuration, if found. do "/etc/gitweb.conf" if -e "/etc/gitweb.conf"; # Point to projects.list file generated by gitosis. # Here gitosis manages the user "git", who has a # home directory of /srv/example.com/git #$projects_list = "/srv/example.com/git/gitosis/projects.list"; $projects_list = "/var/lib/gitosis/gitosis/projects.list"; # Where the actual repositories are located. #$projectroot = "/srv/example.com/git/repositories"; $projectroot = "/var/lib/gitosis/repositories"; # By default, gitweb will happily let people browse any repository # they guess the name of. This may or may not be what you wanted. I # choose to allow gitweb to show only repositories that git-daemon # is already sharing anonymously. #$export_ok = "git-daemon-export-ok"; $export_ok = ""; # Alternatively, you could set these, to allow exactly the things in # projects.list, which in this case is the repos with gitweb=yes # in gitosis.conf. This means you don't need daemon=yes, but you # can't have repositories hidden but browsable if you know the name. # And note gitweb already allows downloading the full repository, # so you might as well serve git-daemon too. # $export_ok = ""; # $strict_export = "true"; # A list of base urls where all the repositories can be cloned from. # Easier than having per-repository cloneurl files. #@git_base_url_list = ('git://example.com'); @git_base_url_list = ('git://your-domain.com'); $feature{'search'}{'default'} = [1]; $feature{'blame'}{'default'} = [1]; $feature{'pickaxe'}{'default'} = [1]; $feature{'grep'}{'default'} = [1]; $feature{'snapshot'}{'default'} = [1];
gitosisã°ã«ã¼ãã«apacheã¦ã¼ã¶ã追å
usermod -G gitosis apache
gitosis-adminã®gitosis.confã«gitwebããã®åç
§è¨±å¯è¨å®ã追å
[gitosis] gitweb = yes [group gitosis-admin] writable = gitosis-admin git-test members = [email protected] user-name@host-name [repo git-test] description = Git Test Project owner = [email protected] gitweb = yes
ããã§gitosisã§ããããªãªã¢ã¼ããã¹ãããgitã®ãµã¼ãã¬ãã¸ããªã«pushãããpullãããå¤æ´å·®åãgitwebã§ãã©ã¦ã¶ä¸ã§ç¢ºèªãããåºæ¥ãã