Git : Gitolite : Add Repositories2021/06/18 |
Add New Repository in Gitolite.
|
|
[1] | For example, add a new repository [project01]. Work with Gitolite admin user. |
[gitolite3@dlp ~]$
vi ~/gitolite-admin/conf/gitolite.conf # add to the end # all users in Gitolite can read/write repo project01 RW = @all cd ~/gitolite-admin [gitolite3@dlp gitolite-admin]$ git commit -a -m "Add project01 repository" [master bd3bff0] Add project01 repository 1 file changed, 3 insertions(+) [gitolite3@dlp gitolite-admin]$ git push Enumerating objects: 7, done. Counting objects: 100% (7/7), done. Delta compression using up to 2 threads Compressing objects: 100% (3/3), done. Writing objects: 100% (4/4), 397 bytes | 397.00 KiB/s, done. Total 4 (delta 0), reused 0 (delta 0), pack-reused 0 remote: Initialized empty Git repository in /var/lib/gitolite3/repositories/project01.git/ To ssh://GitServer/gitolite-admin 1ad511f..bd3bff0 master -> master |
[2] | Verify to access to the repository added above with a user in Gitolite. |
# list available repositories for this user [cent@node01 ~]$ ssh GitServer info hello id_cent, this is gitolite3@dlp running gitolite3 3.6.12-1.el8 on git 2.27.0 R W project01 R W testing[cent@node01 ~]$ mkdir mywork [cent@node01 ~]$ cd mywork [cent@node01 mywork]$ git config --global user.name "cent" [cent@node01 mywork]$ git config --global user.email "cent@node01.server.world" [cent@node01 mywork]$ git clone ssh://GitServer/project01 Cloning into 'project01'... warning: You appear to have cloned an empty repository.[cent@node01 mywork]$ total 0 drwxrwxr-x. 3 cent cent 18 Jun 18 01:06 project01
[cent@node01 mywork]$
[cent@node01 project01]$ cd project01
echo testfile1 > testfile1.txt [cent@node01 project01]$ git add testfile1.txt [cent@node01 project01]$ git commit -m "initial commit" [master (root-commit) 5606151] initial commit 1 file changed, 1 insertion(+) create mode 100644 testfile1.txt[cent@node01 project01]$ git remote -v origin ssh://GitServer/project01 (fetch) origin ssh://GitServer/project01 (push)[cent@node01 project01]$ git push origin master Enumerating objects: 3, done. Counting objects: 100% (3/3), done. Writing objects: 100% (3/3), 225 bytes | 225.00 KiB/s, done. Total 3 (delta 0), reused 0 (delta 0), pack-reused 0 To ssh://GitServer/project01 * [new branch] master -> master[cent@node01 project01]$ git ls-files testfile1.txt |
Sponsored Link |
|