Git : Access to Repos via Git2024/09/13 |
It's possible to access to Git repositories via Git protocol to install Git Daemon. |
|
[1] | Start Git Daemon. |
root@dlp:~ #
mkdir /usr/local/git root@dlp:~ # sysrc git_daemon_directory="/usr/local/git" root@dlp:~ # sysrc git_daemon_flags="--syslog --reuseaddr --detach --export-all --enable=receive-pack --base-path=/usr/local" root@dlp:~ # service git_daemon enable git_daemon enabled in /etc/rc.conf root@dlp:~ # service git_daemon start Starting git_daemon. # create a shared repository for testing root@dlp:~ # cd /usr/local/git root@dlp:/usr/local/git # mkdir project01.git root@dlp:/usr/local/git # cd project01.git root@dlp:/usr/local/git/project01.git # git init --bare --shared root@dlp:/usr/local/git/project01.git # pw groupadd git_users root@dlp:/usr/local/git/project01.git # chown -R git_daemon:git_users /usr/local/git/project01.git
# add users to the group you allow to access to repo root@dlp:/usr/local/git/project01.git # pw groupmod git_users -m freebsd
|
[2] | Access to test repository from any computer using the Git protocol and check that it works. |
freebsd@node01:~ $
mkdir work2 freebsd@node01:~ $ cd work2
# to specify repository, it is relative path of [--base-path=/usr/local] freebsd@node01:~/work2 $ git clone git://dlp.srv.world/git/project01.git Cloning into 'project01'... warning: You appear to have cloned an empty repository.freebsd@node01:~/work2 $ cd project01 freebsd@node01:~/work2/project01 $ echo testfile > testfile2.txt freebsd@node01:~/work2/project01 $ git add testfile2.txt freebsd@node01:~/work2/project01 $ git commit testfile2.txt -m "Commit" [master (root-commit) 4ba5f86] Commit 1 file changed, 1 insertion(+) create mode 100644 testfile2.txtfreebsd@node01:~/work2/project01 $ git remote -v origin git://dlp.srv.world/git/project01.git (fetch) origin git://dlp.srv.world/git/project01.git (push)freebsd@node01:~/work2/project01 $ git push origin master Enumerating objects: 3, done. Counting objects: 100% (3/3), done. Writing objects: 100% (3/3), 228 bytes | 228.00 KiB/s, done. Total 3 (delta 0), reused 0 (delta 0), pack-reused 0 (from 0) To git://dlp.srv.world/git/project01.git * [new branch] master -> master |
Sponsored Link |