POSTS
FreeBSD 架設 git Server
安裝:
#cd /usr/ports/devel/git; make install clean
------------------------------------------------------------------------
*************************** GITWEB *************************************
If you installed the GITWEB option please follow these instructions:
In the directory /usr/local/share/examples/git/gitweb you can find all files to
make gitweb work as a public repository on the web.
All you have to do to make gitweb work is:
1) Copy the files /usr/local/share/examples/git/gitweb/* to a directory on
your web server (e.g. Apache2) in which you are able to execute
CGI-scripts.
2) In gitweb.cgi, adjust the variable $projectroot to point to
your git repository (that is where you have your *.git project
directories).
*************************** GITWEB *************************************
*************************** CONTRIB ************************************
If you installed the CONTRIB option please note that the scripts are
installed in /usr/local/share/git-core/contrib. Some of them require
other ports to be installed (perl, python, etc), which you may need to
install manually.
*************************** CONTRIB ************************************
------------------------------------------------------------------------
===> Installing rc.d startup script(s)
===> Compressing manual pages for git-1.7.4.1
===> Registering installation for git-1.7.4.1
===> SECURITY REPORT:
This port has installed the following files which may act as network
servers and may therefore pose a remote security risk to the system.
/usr/local/libexec/git-core/git-daemon
This port has installed the following startup scripts which may cause
these network services to be started at boot time.
/usr/local/etc/rc.d/git_daemon
If there are vulnerabilities in these programs there may be a security
risk to the system. FreeBSD makes no guarantee about the security of
ports included in the Ports Collection. Please type 'make deinstall'
to deinstall the port if this is a concern.
For more information, and contact details about the security
status of this software, see the following webpage:
http://git-scm.org/
===> Cleaning for p5-subversion-1.6.15
===> Cleaning for cvsps-2.1
===> Cleaning for git-1.7.4.1
更改設定檔:
git_daemon_enable="YES"
git_daemon_directory="/git"
git_daemon_flags="--export-all --syslog --enable=receive-pack"
新增使用者 git:
#pw groupadd -n git -g 9418
#pw useradd -n git -u 9418 -g git -c git -d /git -s /usr/local/libexec/git-core/git-shell -h -
更改屬性:
# chown git:git /git/
# chmod 755 /git
# mkdir /git/repo/
# chown git:git /git/repo/
# chmod 775 /git/repo/
現在要設定哪些使用者有權限在 /git/cnmc/ 底下建立新的 repo。若使用者只需要 commit,不需要加進來:
# vi /etc/group
...
git:*:9418:steve
因為 git 要用 SSH keys(SSH 金鑰)認證,要先收集所有需要 commit 權限的使用者的 SSH keys。然後放到正確的檔案:
# mkdir /git/.ssh/
# chmod 700 /git/.ssh/
# touch /git/.ssh/authorized_keys
# chmod 600 /git/.ssh/authorized_keys
(把公鑰放進 authorized_keys,一行一個)
# chown -R git:git /git/.ssh/