自己动手一步步搭建repo服务器

转载请注明 http://blog.csdn.net/zywx2009

1. 生成当前用户的ssh-key并添加到服务器上

  ssh-keygen

  cat id_rsa.pub >> ~/.ssh/authorized_keys    (不能破坏掉以前的)

 

2. 构建测试目录

 

root@ubuntu:/path/to/tmp/client/lkk22222# tree
.
├── bionic
│   └── 1.txt
└── bootable
    └── 2.txt

 

//生成bionic对应的裸仓库

cd /root/test/s

root@ubuntu:~/test/s#git init --bare bionic.git
Initialized empty Git repository in /root/test/s/bionic.git/

 

//生成bootable对应的裸仓库
root@ubuntu:~/test/s# git init --bare bootable.git
Initialized empty Git repository in /root/test/s/bootable.git/

 

//生成manifest裸仓库
root@ubuntu:~/test/s# git init --bare manifest.git
Initialized empty Git repository in /root/test/s/manifest.git

 

//克隆生成manifest仓库           

root@ubuntu:~/test/s#git clone /root/test/s/manifest.git

Cloning into 'manifest'...

warning: You appear to have cloned an empty repository.

done.

 

root@ubuntu:~/test/s/manifest# vi default.xml 

    

          fetch="/root/test/s" />

    

    

    

root@ubuntu:~/test/s/manifest# git init

root@ubuntu:~/test/s/manifest#git add default.xml 
root@ubuntu:~/test/s/manifest# git commit -m "add default.xml"
[master (root-commit) 89a8b38] add default.xml
 1 file changed, 8 insertions(+)
 create mode 100755 default.xml

 

针对binoic和bootable裸仓库增加内容

cd /path/to/tmp/1

root@ubuntu:/path/to/tmp/1#git clone /root/test/s/binoic.git/
Cloning into 'binoic'...
warning: You appear to have cloned an empty repository.
done.

root@ubuntu:/path/to/tmp/1# ls
binoic
root@ubuntu:/path/to/tmp/1# cd binoic/
root@ubuntu:/path/to/tmp/1/binoic# touch 1.txt
root@ubuntu:/path/to/tmp/1/binoic# git add 1.txt 
root@ubuntu:/path/to/tmp/1/binoic# git commit -m "add 1.txt"
[master (root-commit) 7a391c7] add 1.txt
 1 file changed, 0 insertions(+), 0 deletions(-)
 create mode 100644 1.txt
root@ubuntu:/path/to/tmp/1/binoic# git push origin master:master
Counting objects: 3, done.
Writing objects: 100% (3/3), 201 bytes | 0 bytes/s, done.
Total 3 (delta 0), reused 0 (delta 0)
To /roo/test/s/binoic.git/
 * [new branch]      master -> master

root@ubuntu:/path/to/tmp/1#git clone /roo/test/s/bootable.git
Cloning into 'bootable'...
warning: You appear to have cloned an empty repository.
done.
root@ubuntu:/path/to/tmp/1# ls
bootable
root@ubuntu:/path/to/tmp/1# cd bootable/
root@ubuntu:/path/to/tmp/1/bootable# touch 2.txt
root@ubuntu:/path/to/tmp/1/bootable# git add 2.txt 
root@ubuntu:/path/to/tmp/1/bootable# git commit -m "add 2.txt"
[master (root-commit) 95abca4] add 2.txt
 1 file changed, 0 insertions(+), 0 deletions(-)
 create mode 100644 2.txt

root@ubuntu:/path/to/tmp/1/bootable# git push origin master:master

Counting objects: 3, done.
Writing objects: 100% (3/3), 201 bytes | 0 bytes/s, done.
Total 3 (delta 0), reused 0 (delta 0)
To /roo/test/s/bootable.git/
 * [new branch]      master -> master

 

mkdir /root/test/c

获取repo服务器的mirror裸仓库

repo init -u /root/test/s/manifest.git -b master --miror

repo sync -j4

 

 获取repo服务器的code

repo init -u /root/test/s/manifest.git -b maste

repo sync -j4

 

fatal: 'xxxxx' does not appear to be a git repository

fatal: Could not read from remote repository.

搭建时,遇到了是权限问题

 

你可能感兴趣的:(自己动手一步步搭建repo服务器)