f19f
![]() |
|
|
|
|
|||||||
| Howtos & FAQs (Moderated) Would you like to share some of your solutions for certain problems? Tips or tricks? Post here. All new topics are automatically moderated. |
![]() |
|
|
Thread Tools | Display Modes |
|
#1
|
|||
|
|||
|
This howto will describe how to setup a Git repository:
For those who don't know what Git is:
You should know how to use Git before reading on. Install devel/git. Select GITWEB. SVN, P4, and CVS are optional. Deselect them if you don't plan to use them. Create a git user with uid and gid as 9418: Code:
# 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 - Make sure the permissions of the directory are correct and create /git/base/: Code:
# chown git:git /git/ # chmod 755 /git # mkdir /git/base/ # chown git:git /git/base/ # chmod 775 /git/base/ Code:
# vi /etc/group ... git:*:9418:user1,user2 Code:
# mkdir /git/.ssh/ # chmod 700 /git/.ssh/ # touch /git/.ssh/authorized_keys # chmod 600 /git/.ssh/authorized_keys (Put the public keys into authorized_keys, one per line) # chown -R git:git /git/.ssh/ Code:
$ mkdir /git/base/test.git $ cd /git/base/test.git && git init --bare --shared Code:
$ mkdir ~/test $ cd ~/test && git init $ echo '123456' > foo $ git add . $ git commit Code:
$ git remote add origin git@git.example.com:base/test.git $ git push origin master Since the git repo should be up and working by now, let's enable gitweb for web access. Apache's VirtualHost will be used for this. Copy gitweb files to /home/www/git/: Code:
$ cp /usr/local/share/examples/git/gitweb/git* /home/www/git/ Code:
<VirtualHost *:80>
ServerAdmin webmaster@yourhostname
DocumentRoot "/home/www/git"
ServerName git.example.com
ErrorLog "/path/to/errolog"
CustomLog "/path/to/accesslog" combined
<Directory "/home/www/git">
Options ExecCGI
Order allow,deny
Allow from all
DirectoryIndex gitweb.cgi
AddHandler cgi-script .cgi
</Directory>
</VirtualHost>
Code:
-our $projectroot = "/pub/scm"; +our $projectroot = "/git/base"; ... -our $home_link_str = "projects"; +our $home_link_str = "base"; ... -our $site_name = "" +our $site_name = "git.example.com" ... -our $home_text = "indextext.html"; +our $home_text = "content.html"; (Leave empty if unnecessary) ... -our $projects_list_description_width = 25; +our $projects_list_description_width = 40; (Give the description a bit more space) Open up your browser and check if it's working. You might notice that the description of the test repo hasn't been modified yet. You might also want to change the owner. For the description, edit /git/base/test.git/description. Put this into /git/base/test.git/config to change the owner: Code:
[gitweb]
owner = Your Name
Add this to /etc/rc.conf: Code:
git_daemon_enable="YES" git_daemon_directory="/git" git_daemon_flags="--syslog --base-path=/git --export-all" Code:
# /usr/local/etc/rc.d/git_daemon start Code:
$ cd /tmp/ $ git clone git://git.example.com/base/test.git Code:
[gitweb]
owner = Your Name
url = git://git.example.com/base/test.git
Code:
[gitweb]
owner = Your Name
url = git://git.example.com/base/test.git
url = git@git.example.com:base/test.git
Last edited by dennylin93; February 4th, 2010 at 02:30. |
| The Following 15 Users Say Thank You to dennylin93 For This Useful Post: | ||
beginner (January 30th, 2010), blaize (May 2nd, 2013), blodan (July 8th, 2012), draco003 (September 26th, 2011), fefo (January 31st, 2010), graudeejs (January 30th, 2010), jkusniar (February 2nd, 2010), jnbek (May 4th, 2013), lme@ (November 11th, 2012), marino (August 15th, 2010), Symbiosis (June 8th, 2010), unconnected (September 23rd, 2010), UNIXgod (October 21st, 2010), vertexSymphony (October 25th, 2010), VictorGT (October 21st, 2010) | ||
|
#2
|
|||
|
|||
|
Thanks a lot for this useful article!
I've noticed one problem on my FreeBSD 7.2 - looks like it is better to add one more flag (--detach) to the rc.conf: Code:
git_daemon_flags="--syslog --base-path=/git --export-all --detach" Last edited by DutchDaemon; October 21st, 2010 at 18:32. |
| The Following User Says Thank You to VictorGT For This Useful Post: | ||
blodan (July 8th, 2012) | ||
|
#3
|
||||
|
||||
|
You can use devel/py-gitosis to manage git users.
This way system only needs 1 git user. Other users will be virtual users (authorization with ssh public/private keys) It is very nice peace of software... I use gitosis & cgit at git.bsdroot.lv |
| The Following User Says Thank You to graudeejs For This Useful Post: | ||
draco003 (September 26th, 2011) | ||
|
#4
|
|||
|
|||
|
Quote:
Except that, everything works very well ! Thank you. Last edited by DutchDaemon; May 25th, 2012 at 20:43. Reason: Proper formatting / spelling |
| The Following User Says Thank You to blaize For This Useful Post: | ||
blodan (July 8th, 2012) | ||
![]() |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Packages repository | Twister | Installation and Maintenance of FreeBSD Ports or Packages | 4 | December 29th, 2009 08:45 |
| [Solved] Where to put SVN repository? | rhimbo | General | 4 | October 16th, 2009 10:30 |
| Changing package repository | rahulsinner | Installation and Maintenance of FreeBSD Ports or Packages | 3 | April 21st, 2009 04:35 |
| CVS change repository | osa | Web & Network Services | 3 | December 2nd, 2008 09:36 |
| Using X.Org from git | SaveTheRbtz | X.Org | 2 | November 26th, 2008 23:51 |