本文转自: http://forums.freebsd.org/showthread.php?t=10810
How to setup a Git repository
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:
The git-shell is used for this user, and home is set as /git/. The repos will be under /git/base/.
Make sure the permissions of the directory are correct and create /git/base/:
Next, add users to the git group to be able to create repositories under /git/base/. This isn't necessary for users who only need commit access.
We'll be using SSH keys for authenication, so collect the public keys of all the users who need commit access. Then, put the public keys into the right place:
Everything should be set now. Let's create a repo for testing (change to a user that has been added to the git group and has commit access).
Create a local repo and commit:
Now push it into the remote repo (remember to replace git.example.com with your own hostname):
Don't delete the test repo yet.
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/:
Modify Apache settings (change the ServerName and the access and error log paths as necessary):
Now edit gitweb.cgi:
Change the $site_header, $home_text, and $site_footer as needed.
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:
Only the Git protocol isn't working now.
Add this to /etc/rc.conf:
Start the daemon:
You should now be able to clone using the Git protocol. Try it out:
One last thing. You might want to list URLs for cloning repos on the summary page of test.git in gitweb. Just add this line (the url line) to the [gitweb] section of /git/base/test.git/config:
This line can appear more than once if there are multiple URLs:
- Dedicated user for Git repos
- SSH will be used for commits
- Enable gitweb for web access (Apache will be used)
- Anonymous cloning using the Git protocol
For those who don't know what Git is:
- Git
- Git (Wikipedia)
- Revision control
- Distributed revision control
- Comparison of revision control software
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 13 Users Say Thank You to dennylin93 For This Useful Post: |
beginner (January 30th, 2010), blodan (July 8th, 2012), draco003 (September 26th, 2011), fefo (January 31st, 2010), graudeejs (January 30th, 2010), jkusniar (February 2nd, 2010), 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)
|
« Previous Thread | Next Thread »
相关推荐
freeBSD11.0系列安装文档,本人实际操作记录,希望给大家带来上些帮助
freeBSD11.0系列安装文档,本人实际操作记录,希望给大家带来上些帮助
使代码处于足够好的状态,以便将其集成到源软件上的主要Valgrind存储库中(git://sourceware.org/git/valgrind.git) 替换当前的Valgrind FreeBSD端口版本。 当前版本为3.10,带有一些向后移植的修补程序。 我不...
关于本教程解释了如何在 FreeBSD 上安装以及 PHP、Node.js、git 和几个任务运行器。介绍如果您使用 PHP(PHP 超文本预处理器)开发应用程序,您可能已经阅读或听说现在许多项目选择敏捷方法来快速进行。 这包括测试...
kubectl-freebsd-如何在FreeBSD上构建和运行kubectl TLDR-简单方法 $ fetch https://github.com/dcasati/kubectl-freebsd/releases/download/release-1.9/kubectl $ chmod +x kubectl $ sudo mv kubectl /usr/local/...
您可以通过几种不同的方式来安装Git LFS客户端,具体取决于您的设置和首选项。 Linux用户。 可从获得Debian和RPM软件包。 macOS用户。 瓶已分发,可以通过brew install git-lfs 。 Windows用户。 Git LFS包含在的...
关键词:gitbash git-bash git bash bashgit bash-git bash git gitksh git-ksh git ksh kshgit ksh-git ksh git shell 插件git shell 集成; Linux FreeBSD Windows 最后更改:2013-12-10 - v1.2.0 - 错误修复。 ...
FreeBSD源代码树必须位于$SRC_BASE (默认为/usr/src )才能从git构建。 pkg install python36 git-lite py36-cython py36-pip git clone --recursive https://github.com/iocage/iocage 以root身份make install...
(我在freebsd上安装了Dropbox,因为我运行的是nfs home dirs,并且在某些旧版机器上运行了dropbox) 在我的名为3d-recorder的github存储库中可以看到一个使用此配置存储库的演示项目。 makefile.standard包括...
NetworkMgr是用于FreeBSD,GhostBSD,TrueOS和DragonFlyBSD的Python GTK3网络管理器。 NetworkMgr支持netif和OpenRC网络。 安装 要在NetworkMgr之前安装的软件包。 pkg install sudo py37-setuptools py37-gobject3...
使用git命令克隆此存储库并构建/安装atom: git clone https://github.com/tagattie/FreeBSD-Atom cd FreeBSD-Atom/editors/atom make install clean 平台 基于FreeBSD 11和12 amd64构建。 学分 由@ prash-wghats...
git clone https://github.com/tony/i3-gaps-freebsd.git cd i3-gaps-freebsd # one way make WITH=gaps install clean # via option tui make config make install clean 这个回购 为了保留历史记录并合并将来的...
参考在 FreeBSD 上提到 Nix 的博客文章有趣的问题、拉取请求和其他相关工作 Nix 到 pkgsrc 的 WIP 端口: ://wip.pkgsrc.org/cgi-bin/gitweb.cgi p pkgsrc-wip.git;a = tree;f = nix;hb = HEAD ...
注意:目前仅在FreeBSD上编译。入门获取代码git clone https://github.com/danlrobertson/capsicum-rs cd capsicum-rs cargo build使用capsicum-rs编写代码进入功能模式请使用capsicum :: {输入,沙盒}; 使用std :: ...
工作流程基本上是使用 git 向 phabricator 提交补丁,然后使用此工具打开相应的 PR。 请小心确保“--name”参数实际上与端口的类别和目录完全匹配,否则它将无法工作。 警告... FreeBSD 的 SSL 已损坏: ://bugs....
GitLab6-on-Freebsd安装指南 本安装指南是针对Freebsd 8.3创建的,并在其中进行了测试。 由于上游不支持FreeBSD,因此它不是用于建立生产服务器的官方安装指南。 要设置开发安装或其他许多安装选项,请查阅。 概述 ...
FreeBSD的poudriere的实用程序和包装器。 注意,这是供开发人员和提交者使用的,尽管非技术人员可能也可以使用它。 您不需要已经安装poudriere。 安装: cd ~ git clone git@github....
点文件Linux或FreeBSD用户配置文件bash的屏幕截图 截图tmux用法 $ git clone https://github.com/appleboy/dotfiles.git && cd dotfiles && source bootstrap.sh安装 $ sh <(curl https://j.mp/spf13-vim3 -L)...
有关安装和使用的信息,请参见: : 局限性 经过以下操作系统和发行版测试: FreeBSD 12.0+ 硬化的BSD 支持 要获得与CBSD相关的支持,讨论和对话,请加入Telegram CBSD用户组频道:@cbsdofficial 网页链接: : ...
ambnb是一个 freeBSD 内核模块,它允许用户通过 sysctl 界面管理他们屏幕的背光。 它最初由 Patrick Lamaiziere 于 2009 年编写。它至少适用于从 1,2 到 4,2 的 macbookpro(未针对其他型号进行测试。我稍微修改了...