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. -
Edit
config
, add:
[gitweb]
owner = Juan J. Martinez <my email>
Also:
- double check default branch is “main”, or the about section won’t work (check HEAD)
- on the repo:
git remote add origin reidrac@git.usebox.net:/home/reidrac/repos/my_repo_name
git push origin main -u
Default branch “main”
For git 2.28 or later:
git config --global init.defaultBranch main
Or just edit HEAD
and s/master/main/
.