root@ip123:~# mkdir -p /srv/git
root@ip123:~# cd /srv/git
python_pg.git,一般副檔名設定為 .git。
root@ip123:/srv/git# git init --bare python_pg.git hint: Using 'master' as the name for the initial branch. This default branch name hint: is subject to change. To configure the initial branch name to use in all hint: of your new repositories, which will suppress this warning, call: hint: hint: git config --global init.defaultBranch <name> hint: hint: Names commonly chosen instead of 'master' are 'main', 'trunk' and hint: 'development'. The just-created branch can be renamed via this command: hint: hint: git branch -m <name> Initialized empty Git repository in /srv/git/python_pg.git/
python_pg.git 目錄產生的資料。
root@ip123:/srv/git# ll python_pg.git/ total 16 drwxr-xr-x. 2 root root 6 Feb 3 07:38 branches -rw-r--r--. 1 root root 66 Feb 3 07:38 config -rw-r--r--. 1 root root 73 Feb 3 07:38 description -rw-r--r--. 1 root root 23 Feb 3 07:38 HEAD drwxr-xr-x. 2 root root 4096 Feb 3 07:38 hooks drwxr-xr-x. 2 root root 21 Feb 3 07:38 info drwxr-xr-x. 4 root root 30 Feb 3 07:38 objects drwxr-xr-x. 4 root root 31 Feb 3 07:38 refs
root@ip123:/srv/git# mv python_pg.git/hooks/post-update.sample python_pg.git/hooks/post-update root@ip123:/srv/git# cat python_pg.git/hooks/post-update #!/usr/bin/sh # # An example hook script to prepare a packed repository for use over # dumb transports. # # To enable this hook, rename this file to "post-update". exec git update-server-info
root@ip123:/srv/git# chmod +x python_pg.git/hooks/post-update
root@ip123:/srv/git# vi python_pg.git/config
[core]
repositoryformatversion = 0
filemode = true
bare = true
[http]
receivepack = true