FreeBSD 架設 git Server

安裝:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#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

更改設定檔:

1
2
3
git_daemon_enable="YES"
git_daemon_directory="/git"
git_daemon_flags="--export-all --syslog --enable=receive-pack"

新增使用者 git:

1
2
#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 -

更改屬性:

1
2
3
4
5
# chown git:git /git/
# chmod 755 /git
# mkdir /git/repo/
# chown git:git /git/repo/
# chmod 775 /git/repo/

現在要設定哪些使用者有權限在 /git/cnmc/ 底下建立新的 repo。若使用者只需要 commit,不需要加進來:

1
2
3
# vi /etc/group
...
git:*:9418:steve

因為 git 要用 SSH keys(SSH 金鑰)認證,要先收集所有需要 commit 權限的使用者的 SSH keys。然後放到正確的檔案:

1
2
3
4
5
6
# 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/

2 thoughts on “FreeBSD 架設 git Server

  1. Another issue is really that video gaming became one of the all-time biggest forms of
    recreation for people spanning various ages. Kids enjoy video games,
    plus adults do, too. The particular XBox 360 is probably the
    favorite gaming systems for people who love to have a lot of
    games available to them, plus who like to experiment with live with some others all over the world.

    Thank you for sharing your ideas.

    Visit my blog post quibids scam

  2. Wonderful goods from you, man. I have understand your stuff prior to and you’re just too wonderful. I actually like what you’ve received right here, certainly like what you are stating and the best way during which you assert it. You make it entertaining and you continue to take care of to keep it sensible. I cant wait to learn much more from you. That is actually a great site.

quibids scam 發表迴響 取消回覆

你的電子郵件位址並不會被公開。 必要欄位標記為 *