Git : Access to Repos via Git2022/09/27 |
It's possible to access to Git repositories via Git protocol to install Git Daemon.
|
|
[1] | Install Git Daemon. |
root@dlp:~#
apt -y install git-daemon-sysvinit
root@dlp:~#
vi /etc/default/git-daemon # change GIT_DAEMON_ENABLE=true GIT_DAEMON_USER=gitdaemon GIT_DAEMON_BASE_PATH=/var/lib GIT_DAEMON_DIRECTORY=/var/lib/git # Additional options that are passed to the Daemon. # add options GIT_DAEMON_OPTIONS="--export-all --enable=receive-pack"root@dlp:~# systemctl restart git-daemon |
[2] | It's possible to access to [/var/lib/git] directory with Git protocol by default. [/var/lib/git] is writable only by root account, so it needs to create repositories with root privilege. For example, create [/var/lib/git/project01.git] and access to [/var/lib/git/project01.git] repository from other Hosts. |
# to specify repository, it is relative path of [--base-path=/var/lib] ubuntu@node01:~/work2$ git clone git://dlp.srv.world/gitproject01.git Cloning into 'project01'... remote: Enumerating objects: 3, done. remote: Counting objects: 100% (3/3), done. remote: Total 3 (delta 0), reused 0 (delta 0), pack-reused 0 Receiving objects: 100% (3/3), done. # impossible to [push] or other writable operations # if need writable, set shared setting like (05) ubuntu@node01:~/work2$ cd project01 ubuntu@node01:~/work2/project01$ echo testfile > testfile2.txt ubuntu@node01:~/work2/project01$ git add testfile2.txt ubuntu@node01:~/work2/project01$ git commit testfile2.txt -m "Commit" [master daf51fa] Commit 1 file changed, 1 insertion(+) create mode 100644 testfile2.txtubuntu@node01:~/work2/project01$ git remote -v origin git://dlp.srv.world/git/project01.git (fetch) origin git://dlp.srv.world/git/project01.git (push)ubuntu@node01:~/work2/project01$ git push origin master ! [remote rejected] master -> master (unpacker error) error: failed to push some refs to 'git://dlp.srv.world/git/project01.git' |
Sponsored Link |