Notes »
Self-hosting git repos
I blogged about it self-hosting git repos.
Adding a new repo
My repos are in /home/reidrac/repos
in my server.
How to add a new repo:
-
Go to the repos directory.
-
Create a directory:
mkdir my_repo_name
cd my_repo_name
git init --bare
- Set the hook for http support:
($PWD
is stil “my_repo_name”)
cp hooks/post-update.sample hooks/post-update
-
Edit
decription
, set the description. -
Optionally, if using cgit, edit
config
and add:
[gitweb]
owner = My name <my email>
Also the default branch must be “main”, or the “about” section in cgit
won’t work (check HEAD).
To get the “idle” column working properly in the index page, add a cgitrc
file with your default branch:
defbranch=main
(at least cgit v1.2.3 still checks for “master” by default)
- On your local copy the repo:
git remote add origin reidrac@git.usebox.net:/home/reidrac/repos/my_repo_name
git push origin main -u
Default branch “main”
If needed, for git 2.28 or later:
git config --global init.defaultBranch main
Links
- A nice theme for cgit
- cgit development – I installed the version packaged by Debian!
- My cgit instance