分页: 1 / 1

14.04架设Git及Gitolite

发表于 : 2018-01-03 17:36
hunterhuang
14.04架设Git及Gitolite,还要将mirror过来的仓库做成主仓库,再分给相关人员,后续还要建分支,是否有相关的人员可以支持,付费的也可以,不想再闭门造车了。有的话请加QQ:22942677
今天建仓库出错,无从下手。

gl-setup -q ~/gitadmin_id_rsa.pub 

                ***** ABORTING *****
        bad reponame 'users/CREATOR/[a-zA-Z].*' or you forgot to set $GL_WILDREPOS
/usr/local/bin/gl-setup: line 197: cd: /home/git/repositories/gitolite-admin.git: No such file or directory
fatal: Unable to create '/.git/index.lock': Permission denied
error: could not lock config file /.git/config: Permission denied
error: could not lock config file /.git/config: Permission denied
                *** FATAL ***
gitadmin_id_rsa.pub maps to no access, not gitadmin_id_rsa.
You will not be able to access gitolite with this key.
Look for the 'ssh troubleshooting' link in http://sitaramc.github.com/gitolite/.
初始化仓库出错。但是我在本地Vware里建又正常。很奇怪。。。

Re: 14.04架设Git及Gitolite

发表于 : 2018-01-04 9:24
九天星

代码: 全选

$ sudo apt-get install git

代码: 全选

$ sudo adduser git

代码: 全选

$ sudo git init --bare sample.git

代码: 全选

$ sudo chown -R git:git sample.git
出于安全考虑,第二步创建的git用户不允许登录shell,这可以通过编辑/etc/passwd文件完成。找到类似下面的一行:

代码: 全选

git:x:1001:1001:,,,:/home/git:/bin/bash
改为:

代码: 全选

git:x:1001:1001:,,,:/home/git:/usr/bin/git-shell
这样,git用户可以正常通过ssh使用git,但无法登录shell,因为我们为git用户指定的git-shell每次一登录就自动退出。

现在,可以通过git clone命令克隆远程仓库了,在各自的电脑上运行:

代码: 全选

$ git clone git@server:/srv/sample.git
Cloning into 'sample'...
warning: You appear to have cloned an empty repository.


406941848.jpg