系统挂了,重做了系统,原来的gitolite
自然是没了.只能从本地库或者镜像库中恢复了.
记录下整个过程,以便下次换到13.04
上快速来过.
记录前先注明几个标识:
1
2
3
| L-r:表示本地登录的`Rover12421`帐号
L-g:表示本地登录`git`帐号
R-g:表示远程(镜像)登录`git`帐号,远端`git`是不能直接使用`ssh`登录的,需要先登录服务器,再使用`su git`切换
|
1
2
3
4
5
6
| L-r:scp ~/.ssh/id_rsa.pub git@git.rover12421.com:/Rs/GitServer/rover12421.pub
R-g:cd /Rs/GitServer/
R-g:gitolite setup -pk rover12421.pub
L-r:mkdir ~/gitolite
L-r:cd ~/gitolite
L-r:git clone git@git.rover12421.com:gitolite-admin git.rover12421.com
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
| L-r:sudo adduser --system --home /home/git --shell /bin/bash git
L-r:sudo passwd git
L-r:su git
L-g:git clone git://github.com/sitaramc/gitolite.git
L-g:mkdir -p $HOME/bin
L-g:vi .bashrc
#Gitolite bin
export PATH=$PATH:$HOME/bin
exit
L-r:scp ~/.ssh/id_rsa.pub git@127.0.0.1:~/rover12421.pub
su git
L-g:cd ~
L-g:gitolite/install -to $HOME/bin
L-g:gitolite setup -pk rover12421.pub
|
1
2
| cd ~/gitolite
git clone git@127.0.0.1:gitolite-admin local
|
- 镜像服务器设置
一共三处修改.这里的版本是
3.5.x
的,修改和我以前记录的3.x
版本有点不一样.
1
2
| L-g:cd ~
L-g:vi .gitolite.rc
|
1
2
| # the Mirroring feature needs this
# HOSTNAME => "gitlocal",
|
==>
1
2
| # the Mirroring feature needs this
HOSTNAME => "gitlocal",
|
1
2
| # enable mirroring (don't forget to set the HOSTNAME too!)
# 'Mirroring',
|
==>
1
2
| # enable mirroring (don't forget to set the HOSTNAME too!)
'Mirroring',
|
1
2
3
4
5
6
7
| # Uncomment or add new commands here.
# 'create',
# 'fork',
# 'mirror',
# 'readme',
# 'sskm',
# 'D',
|
==>
1
2
3
4
5
6
7
| # Uncomment or add new commands here.
# 'create',
# 'fork',
'mirror',
# 'readme',
# 'sskm',
# 'D',
|
1
2
3
4
5
6
| L-g:vi ~/.ssh/config
host gitmirror
user git
hostname git.rover12421.com
port 22
identityfile ~/.ssh/id_rsa
|
key
配置
本地也服务也需要添加server
的key
,不然不会自动同步到镜像上,但是可以不配置镜像key
,以前记录是两个key
都添加了.
1
2
3
4
5
6
7
8
9
10
11
12
| L-g:ssh-keygen -t rsa -C "gitlocal"
L-r:cd ~/gitolite/git.rover12421.com
L-r:sudo cp /home/git/.ssh/id_rsa.pub keydir/server-gitlocal.pub
L-r:sudo chown rover12421:rover12421 keydir/server-gitlocal.pub
L-r:git add keydir/server-gitlocal.pub
L-r:git commit -a -m "Update server key"
L-r:git push
L-r:cd ~/gitolite/local
cp ../git.rover12421.com/keydir/server-gitlocal.pub keydir
L-r:git add keydir/server-gitlocal.pub
L-r:git commit -a -m "Update server key"
L-r:git push
|
1
2
| L-r:cd ~/gitolite/local
L-r:vi conf/gitolite.conf
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
| repo RsApktool
RW+ = @all
option mirror.master = gitlocal
option mirror.slaves = gitmirror
option mirror.redirectOK = all
repo RsPrivate
RW+ = @all
option mirror.master = gitlocal
option mirror.slaves = gitmirror
option mirror.redirectOK = all
repo RsSmali2Java
RW+ = @all
option mirror.master = gitlocal
option mirror.slaves = gitmirror
option mirror.redirectOK = all
repo SpAd
RW+ = @all
option mirror.master = gitlocal
option mirror.slaves = gitmirror
option mirror.redirectOK = all
repo sp2ad
RW+ = @all
option mirror.master = gitlocal
option mirror.slaves = gitmirror
option mirror.redirectOK = all
repo ShakaApktool
RW+ = @all
option mirror.master = gitlocal
option mirror.slaves = gitmirror
option mirror.redirectOK = all
|
1
2
| L-r:git commit -a -m "fix repo setting"
L-r:git push
|
- 最后恢复库到本地
gitolite
服务中
可以使用本地同步的代码库,也可以从镜像上同步下来再同步到本地gitolite
中
1
2
3
| L-r:cd $Project
L-r:cd ShakaApktool
L-r:git push --all
|