单个库的建立。
其实本地库和远程库的创建没有本质的区别,就是路径的不同而已。本地库创建过程:
在dir/repo_bk创建一个库:git init
--bare sample.git
在dir/repo中clone上面的库:git
clone ../repo_bk/sample.git
此时,repo的库可以正常提交。git add..,
git commit..., git
push ...。其中git push
推送的路径是根据.git/config文件中的配置找到的。
多个库的管理,
管理的软件:gitosis或gitolite,下面主要说的是gitosis
https://git-scm.com/book/en/v1/Git-on-the-Server-Gitosis
http://wiki.ubuntu.org.cn/Git服务器Gitosis安装设置
主要的步骤:
1、sudo -H -u git(用户名) gitosis-init
< zql.pub
2、将gitosis-admin克隆到pc端, 可以管理仓库。
用到的命令:
+=================
git init
vim Readme
git add .
git commit -am "init"
git remote add origin
qiliang@192.168.18.133:foo.git
git push
git push origin master
+==========================
若想创建库foo则需要现在gitosis-admin中增加库的信息,
否则会出现:
ERROR:gitosis.serve.main:Repository
read access denied
fatal: Could not read from remote repository.
Please make sure you have the correct access
rights
and the repository exists.
=========
增加后
==========
~/desktop/git/foo1$ git push origin master
Counting objects: 3, done.
Writing objects: 100% (3/3), 209 bytes | 0 bytes/s, done.
Total 3 (delta 0), reused 0 (delta 0)
To qiliang@192.168.18.133:foo1.git
* [new branch]
master ->
master
===========