Create Got Repo
This guide explains how to create a got repository. It assumes you have already read the got usage guide.
Create commit group
First, you may want to create a new group with commit rights:
$ doas groupadd commit
For each existing user you want to give commit rights to:
$ doas usermod -G commit $USER
For each new user you want to create with commit rights:
$ doas useradd -G commit $USER
Replace $USER with the committer's user's name.
Create got directory
We are going to place the repo in /var/git:
$ doas mkdir /var/git $ doas chown -R $USER:commit /var/git $ cd /var/git
Next, you can either clone a repo or create a new one:
Clone Repo
To clone a repo without encryption (WARNING: insecure):
$ got clone git://example.com/repo.git
Replace example.com/repo.git
with your actual path.
HTTP URLs currently requires git?:
$ git clone https://example.com/repo.git
Create Repo
To create an empty repository:
$ gotadmin init /var/git/project
Replace project
with your actual repo name. For example:
Afterwards, we need to import the code for the repository:
$ got import -m "Import sources" -r /var/git/project /path/to/code
-m
provides the log message for the import.-r
provides the repository path.
Replace project
and /path/to/code
. For example:
$ got import -m "Import sources" -r /var/git/ircnowd ~/ngircd
This will import the code from ngircd
into ircnowd
.
Allow commit access
Make sure to set the proper permissions to allow commit access:
$ doas chown -R $USER:commit /var/git/project $ doas chmod -R g+w /var/git/project
Checkout code
To checkout the code:
$ cd ~ $ mkdir ~/project $ got checkout /var/git/project
Commit code
To commit changes in a work tree:
$ got -m "Commit message" commit
Replace Commit message
with a commit message.
See Also: