git服务器搭建过程
需求
硬件需求:一台Ubuntu或者debian电脑(虚拟机),能通过网络访问到。
软件需求:git-core, gitosis, openssh-server, openssh-client, Apache2(Gitweb)
安装配置git服务器
安装配置gitosis
a@server:~$ git config –global user.name “myname”
a@server:~$ git config –global user.email “myname@server “
a@server:~$ cd /tmp
a@server:/tmp$ git clone git://eagain.net/gitosis.git
a@server:/tmp$ cd gitosis
a@server:/tmp/gitosis$ sudo python setup.py install
$ ln -s /home/repo /home/git/repositories
$ exit
usr@pc1:~$ ssh-keygen -t rsa
将公钥拷贝到服务器的/tmp下:
usr@pc1:~$ scp .ssh/id_rsa.pub git@<server>:/tmp
a@server:/tmp/gitosis$ sudo -H -u git gitosis-init < /tmp/id_rsa.pub
Initialized empty Git repository in /home/repo/gitosis-admin.git/
Reinitialized existing Git repository in /home/repo/gitosis-admin.git/
a@server:/home/git$ sudo passwd root
a@server:/home/git$ su
root@server:/home/git # cd repositories
root@server:/home/git/repositories # cd gitosis-admin.git/
root@server:/home/git/repositories/gitosis-admin.gi t # sudo chmod 755 /home/repo/gitosis-admin.git/hooks/post-update
root@server:/home/git/repositories/gitosis-admin.git # exit
在服务器上新建一个测试项目仓库
我建了一个叫“teamwork”的仓库。
切换到git用户:
a@ubuntu:/home/git$ su - git
$ cd /home/prj_git
$ mkdir teamwork.git
$ cd teamwork.git
$ git init --bare
$ exit
管理gitosis的配置文件
刚刚提到,gitosis本身的配置也是通过git来实现的。在你自己的开发机里,把gitosis-admin.git这个仓库clone下来,就可以以管理员的身份修改配置了。
fatal: The remote end hung up unexpectedly
root@server:/home/a/work/gitosis-admin # cp /path/to/.ssh/id_rsa.pub ./keydir/b.pub
root@server:/home/a/work/gitosis-admin # exit
[gitosis][group hello_ro]
readonly = teamwork
members = lz
team组有a,b两个成员,该组对teamwork仓库有读写权限;
team_ro组有lz一个成员,对teamwork仓库有只读权限。
加入新文件、提交并push到git服务器:
usr@pc1:~/work/gitosis-admin$ git add .
usr@pc1:~/work/gitosis-admin$ git commit -am “add teamweok prj and users”
usr@pc1:~/work/gitosis-admin$ git push origin master
初始化测试项目
usr@pc1:~/work$ cd teamwork-ori/
usr@pc1:~/work/teamwork-ori$ git init
usr@pc1:~/work/teamwork-ori$ git push origin master
$ vim hello
$ git add .
$ git commit -am “b add”
$ exit
添加已有git项目
首先需要从你的工作仓库中得到一个纯仓库, 比如你的工作目录为~/kernel, 你想导出纯仓库到你的优盘里,然后拷贝到gitserver上去。
$ git clone –bare ~/kernel /media/udisk
然后就拿着优盘,交给gitserver的管理员,让他拷贝到/home/repo/下,同时需要配置 gitosis相关配置文件哦,这个就不用再说了吧。比如:下载ALSA库:
git clone git://android.git.kernel.org/platform/external/alsa-lib.git
git clone git://android.git.kernel.org/platform/external/alsa-utils.git
git clone –bare alsa-lib alsa-lib.git
git clone –bare alsa-utils alsa-utils.git
配置gitweb
1. 安装gitweb
sudo apt-get install gitweb
2. 安装apache2
sudo apt-get install apache2
3. 配置gitweb
(1)默认没有 css 加载,把 gitweb 要用的静态文件连接到 DocumentRoot 下:
cd /var/ www/
sudo ln -s / usr/ share/ gitweb/* .
(注意后面的点)
(2)修改配置:
sudo vi /etc/ gitweb.conf
将 $projectroot 改为gitosis-admin.git所在目录: /home/git/repositories
(3)修改 /home/git/repositories权限,默认情况下,gitosis将 repositories权限设置为不可读的
sudo chmod 777 -R /home/git/repositories
11.编辑apache2配置文件,建立web站点 (默认情况下可以忽略此步骤)
(1) 编辑apache2配置文件
ubuntu中默认的web目录是/var/www,默认的cgi目录是 /usr/lib/cgi-bin/,安装完成gitweb后,gitweb的gitweb.cgi会自动放置
到该目录下。如果你的cgi路径不是默认的/usr/lib/cgi-bin/,需要将gitweb安装在/usr/lib/cgi-bin中的gitweb.cgi复制到原来配置
的cgi-bin路径,并修改apache的配置文件/etc/apache2/apache.conf:
SetEnv GITWEB_CONFIG /etc/gitweb.conf
gitweb.conf配置文件形如:(可自行修改,这里不做详细介绍)
<Directory "/srv/www/cgi-bin/gitweb">
Options FollowSymlinks ExecCGI
Allow from all
AllowOverride all
Order allow,deny
<Files gitweb.cgi>
SetHandler cgi-script
</Files>
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^.* /gitweb.cgi/$0 [L,PT]
</Directory>
(2)重新启动apache:sudo /etc/init.d/apache2 restart,访问http://localhost/cgi-bin/gitweb.cgi
<以下未经测试>
a2dissite gitserver 禁用
a2ensite gitserver 使能
/etc/init.d/apache2 restart 重启
git clone git://git.kernel.org/pub/scm/git/git.git
cd git
make GITWEB_PROJECTROOT=”/home/repo” prefix=/usr gitweb/gitweb.cgi
cd gitweb
cp -av git* /home/repo/
<VirtualHost 172.20.146.39:80>
ServerName 172.20.146.39
DocumentRoot /home/repo
ScriptAlias /cgi-bin/ /home/repo
<Directory /home/repo>
Options ExecCGI +FollowSymLinks +SymLinksIfOwnerMatch
AllowOverride All
order allow,deny
Allow from all
AddHandler cgi-script cgi
DirectoryIndex gitweb.cgi
</Directory>
</VirtualHost>
chmod a+r repo
chmod a+x repo
6./etc/init.d/apache2 restart
git clone http://192.168.1.1/alsa-lib.git
git clone http://192.168.1.1/alsa-utils.git
git访问方式:
git clone git@192.168.1.1:alsa-lib.git
Web网页浏览:
http://192.168.1.1
1.windows文件命名不区分大小 写,而linux支持。这样android源码下载时会出现一下问题。大约有15个文件存在这个问题。
2.库的描述文件在.git文件夹的description文件中。编辑该文件,在gitweb页中就会有 description。
3.gitosis库hooks下的post- update不是由post-update.sample重命名过来的,它们不一样。post-update可以更新工作目录,保持与库一致。没有它配置 文件是不会更新的。
4.(1)git@hello:/home/git$ git add .
error: readlink(“external/openssl/apps/md4.c”): No such file or directory
error: unable to index file external/openssl/apps/md4.c
fatal: adding files failed
Initialized empty Git repository in /external/openssl/.git/
root@/external/openssl # git add .
error: readlink(“apps/md4.c”): No such file or directory
error: unable to index file apps/md4.c
fatal: adding files failed
(3) root@android-2.1_r2$ rm -Rf .repo
root@android-2.1_r2 $ find . -name “.git” | xargs rm -Rf
相关推荐
Ubuntu下Git服务器打搭建 客户端的使用教程和git学习资料等,资源分虽然要了10分但是这是我一周总结的,现在没分了想坑一点积分。有积分后我就免费下载了,下载的人不要为要积分而喷。也谢谢大家给我积分
关于ubuntu下git服务器的搭建
在ubuntu 12.04 上完成的git服务器搭建步骤。
Ubuntu下用Gitosis搭建GIT代码服务器及Eclipse下的Git操作
Ubuntu下git服务器的搭建和基本使用[参考].pdf
。。。
。。。
Gitweb提供了git版本库的图形化web浏览功能,能看代码库,提交日志等服务器操作系统:ubuntu14.04gerrit所用包:gerrit-2.10.war,此版本必须要用jdk7以上,本人用了jdk7.1.ubuntu服务器安装git2.ubuntu服务器
自己从零开始搭建git + gitweb + gerrit服务器 软硬件环境 物理机:Windows10 64位 VMware版本:VMware Workstation 12 Ubuntu版本:ubuntu-14.04-server-amd64.iso
Ubuntu 18.04_ Install Gerrit for Git code review ubuntu 上部署 gerrit 服务器 , 使用 apache2 作为web端, 可手动设置用户名密码.
qnap-git-server:在QNAP服务器上托管您自己的Git存储库
目录 I 1. 设置 QSDK 开发环境 3 ...1.2.1 Ubuntu下搭建tftp服务器设置方法 5 TFTP服务器最简单安装配置 5 安装TFTP-SERVER 5 配置TFTP服务器 5 .重新启动TFTP服务 6 TFTP功能 测试 6 2 下载、解压和编译 QSDK 7
[linux] Ubuntu20.04上安装搭建私有Git服务器Gitea,这篇博客中使用的gitea文件,你也可以访问https://raw.githubusercontent.com/go-gitea/gitea/master/contrib/systemd/gitea.service进行下载
这是我在搭建Django项目时候的过程,拿来总结记录,以备不时之需。 项目采用nginx+uwsgi的搭配方式。 项目依赖包采用 requirements.txt 文件管理的方式。 本地准备工作 确认项目能够运行起来,没有 bug 将当前环境...
GitLab 5.0以前版本要求服务器端采用 Gitolite 搭建,5.0版本以后不再使用 Gitolite ,采用自己开发的 gitlab-shell 来实现。如果你觉得安装麻烦可以使用 GitLab Installers 一键安装程序。系统要求:Ubuntu/...
/bin/shcalc.execalcopen/Applications/Calculator.app/gnome-calculator然后将工程提交到git服务器,由于github已经不能提交.Git这种目录,我就自己搭建了一个服务器. gitremoteaddorigingit@10.10.10.133:/home/git...
上搭建环境的过程如下所示。确认的环境是Ubuntu 20.042 LTS 。 准备 OpenOCD Ubuntu 包中的 OpenOCD 太旧,无法处理 DAP,因此我将获取源代码并构建它。服务器似乎很慢,需要很长时间才能获取代码。 sudo apt ...
安装 在Ubuntu / Debian上安装Ruby ...搭建开发环境 运行以下命令,以告知Rails这是一个开发环境。 rake db:migrate 运行Rails服务器 使用以下命令启动服务器。 rails server 此后,该营地网站应在 快乐黑客!!!