用户工具

站点工具


linux:gitolite
  • 创建git用户
useradd git
su - git
  • 编译gitolite
git clone https://github.com/sitaramc/gitolite
mkdir -p $HOME/bin
gitolite/install -to $HOME/bin
//下载zip包时,还需要git bundle create /tmp/repositoryname.bundle --all
  • 准备管理员公钥并初始化
ssh-keygen  //生成.ssh/id_rsa、.ssh/id_rsa.pub,然后用自己的密钥替换内容(git关联id_rsa名字,或配置.ssh/config)
gitolite setup -pk .ssh/id_rsa.pub
//创建了/home/git/repositories/gitolite-admin.git,/test.git
  • 通过gitolite-admin管理用户和仓库
git clone git@xlongwei.com:gitolite-admin
  • 添加仓库和用户
//收集用户的公钥到keydir目录,命名规则{name}.pub
vi conf/gitolite.conf
@admin = user1 user2 //定义用户组,R读 W写 +强制更新 C创建 repo dir/..*目录内权限
repo foo
  RW+                     =   alice
  -   master              =   bob  #分支默认refs/heads/
  -   refs/tags/v[0-9]    =   bob  #标签需要完整路径
  RW                      =   bob
  RW  refs/tags/v[0-9]    =   carol
  R                       =   dave
    
//RW+ 全部权限,bob可以读写(非master分支),carol可以创建v1之类的tag,dave可以读取
//git add .
//git commit -m "add repo foo"
//git push
repo foo bar //权限控制相同时,repo可以跟多个仓库名,@repoGroup=foo,仓库分组时可以多行
repo @all
  R = @all #所有人可以读取所有项目,可以限于@manager分组、或RW+ = @admin

* 解决:no matching key exchange method found. Their offer: diffie-hellman-group1-sha1

vi  ~/.ssh/config  //或vi /etc/ssh/ssh_config
Host *
KexAlgorithms +diffie-hellman-group1-sha1
HostKeyAlgorithms=+ssh-dss
Host xlongwei.com
KexAlgorithms +diffie-hellman-group1-sha1
HostKeyAlgorithms=+ssh-dss
PubkeyAcceptedAlgorithms +ssh-rsa
IdentityFile ~/.ssh/xlongwei.git
apidemo
bpmdemo
redis-session
xlongwei/apidoc
xlongwei/deploy
xlongwei/light4j
xlongwei/light-service
xlongwei/logserver
xlongwei/logserver-spring-boot-starter
linux/gitolite.txt · 最后更改: 2022/05/06 15:30 由 admin