Git : Access to Repos via Git2024/07/24 |
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
# create a shared repository for testing root@dlp:~# cd /var/lib/git root@dlp:/var/lib/git# mkdir project01.git root@dlp:/var/lib/git# cd project01.git root@dlp:/var/lib/git/project01.git# git init --bare --shared root@dlp:/var/lib/git/project01.git# chown -R gitdaemon:users /var/lib/git/project01.git |
[2] | Access to test repository from any computer using the Git protocol and check that it works. |
# to specify repository, it is relative path of [--base-path=/var/lib] ubuntu@node01:~/work2$ git clone git://dlp.srv.world/git/project01.git Cloning into 'project01'... warning: You appear to have cloned an empty repository.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 (root-commit) 732db30] 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 Enumerating objects: 3, done. Counting objects: 100% (3/3), done. Writing objects: 100% (3/3), 227 bytes | 227.00 KiB/s, done. Total 3 (delta 0), reused 0 (delta 0), pack-reused 0 To git://dlp.srv.world/git/project01.git * [new branch] master -> master |
Sponsored Link |