Gitea Auto create repositories

I have been using Gitea as a source code repo for quite some time now. My instance is hosted within a docker container.

It’s really working fine, but when I wanted to create a new repository, I had to first create it in the web interface. I had a lots of old sources I wanted to add in my repo, and after a few having to use the web interface, I decided to take a closer look.

Gitea Config File

First, need to add 2 new entries in the [repository] section of our config file :

1
2
3
4
[repository]
ENABLE_PUSH_CREATE_USER = true
ENABLE_PUSH_CREATE_ORG =  true
ROOT=/data/git/repositories

Pushing to new Repos

Here are the list of operations I do to push a new repo:

1
2
3
4
5
6
7
cd NewRepo
git init
git checkout -b main
git add *.*
git commit -m "Initial Upload"
git remote add origin https://git.localrepo.home/Archives/NewRepo.git
git push origin main

Where Archives is an Organization Name in my Gitea container.

References

Gitea Push to Create