Hola, I was basically using cvs for a long time for OpenBSD and some Github for open source projects, until this thread on ports made me decide to just move all my repos to GoT, which I had the privilege to see an early version long time ago in a hackthon :).
So my setup is pretty easy and I will explain the "migration" and how to keep in sync my "new" GoT repos with upstream providers such as Codeberg, Sourcehut and Github.
Since I have cvs repos I need to migrate them to GoT, so I will use cvs2gitdump to create a dump of it, if it's not your case, you just can avoid it, same if you don't want to have a public GoTWeb with the repos, otherwise:
$ doas pkg_add cvs2gitdump git got gotweb
I will create now a dump of my cvs repo and then, create my new one using git init, for the import I will use the dump and git with fast-import, if this is not your setup and you just want to create and import files to a repo, you can use got init and got import.
** Go here for more examples with got **
I am doing this on my got/cvs server so I will assume you have a similar setup with a separated partition for the repos, in my case I have a 9GB one (/got):
$ cd /annoncvs/cvs
$ cvs2gitdump -a -k CVS -e gonzalo ansible-role-mailserver > ansible-role-mailserver.dump
** walk cvs tree
** cvs has 1 changeset
** dumped
$ cd /got
$ git init --bare ansible-role-mailserver
... MAGIC ...
$ git --git-dir /got/ansible-role-mailserver fast-import < /annoncvs/cvs/ansible-role-mailserver.dump
... MORE MAGIC ...
$ ls -al /got/ansible-role-mailserver
total 40
drwxr-xr-x 7 got _gitdaemon 512B Jan 25 16:07 ./
drwxr-xr-x 17 got _gitdaemon 512B Jan 27 13:49 ../
-rw-r--r-- 1 got _gitdaemon 23B Jan 24 13:14 HEAD
drwxr-xr-x 2 got _gitdaemon 512B Jan 24 13:14 branches/
-rw-r--r-- 1 got _gitdaemon 66B Jan 24 13:14 config
-rw-r--r-- 1 got _gitdaemon 51B Jan 24 13:16 description
drwxr-xr-x 2 got _gitdaemon 512B Jan 24 13:14 hooks/
drwxr-xr-x 2 got _gitdaemon 512B Jan 24 13:14 info/
drwxr-xr-x 11 got _gitdaemon 512B Jan 25 16:07 objects/
drwxr-xr-x 4 got _gitdaemon 512B Jan 24 13:14 refs/
If you want to be able to play over the protocol git:// we need to configure git-daemon(1) (already installed with git) with a couple lines on /etc/rc.conf.local, if you plan to use just ssh:// you can skip this step:
$ grep gitdaemon /etc/rc.conf.local
gitdaemon_flags=--listen=192.168.0.200 /got
gitdaemon_user=_gitdaemon
pkg_scripts=gitdaemon
git-daemon(1) verifies that the directory has the magic file "git-daemon-export-ok" so for this we need to "touch" it inside our got dir.
$ touch /got/ansible-role-mailserver/git-daemon-export-ok
$ doas rcctl enable gitdaemon
$ doas rcctl start gitdaemon
Now we have our git-daemon(1) listening, to work with the files, we'll need to clone the repo and then to checkout it to get a proper got-worktree(5) and working files, I will do this from another machine:
musashi $ cd ~/got
musashi $ got clone ssh://192.168.0.200/got/ansible-role-mailserver ansible-role-mailserver.got
Connecting to 192.168.0.200
server: Enumerating objects: 122, done.
server: Counting objects: 100% (122/122), done.
server: Compressing objects: 100% (56/56), done.
server: Total 122 (delta 52), reused 114 (delta 49), pack-reused 0
22.8K fetched; indexing 100%; resolving deltas 100%
Fetched 9bd18850754892379f71552b681881197af8231784.pack
Created cloned repository 'ansible-role-mailserver.got'
musashi $ got checkout ~/got/ansible-role-mailserver.got ~/code/ansible-role-mailserver
... A LOT OF MAGICAL FILES ...
musashi $
If you checkout ~/got/ansible-role-mailserver.got you will have the git-repository(5) and if you check on ~/code/ansible-role-mailserver, you will have the actual files to work with, the workflow is similar to git
musashi $ cd ~/code/ansible-role-mailserver
musashi $ vim LICENSE
... SOME AWESOME CHANGE ...
musashi $ got status
M LICENSE
musashi $ got diff
diff 909dcc136ee4c114f15631590874851001819f5e ~/code/ansible-role-mailserver
blob - 907bf621f00e06626d6b6bb3041e57110e38521b
file + LICENSE
--- LICENSE
+++ LICENSE
@@ -1,6 +1,6 @@
MIT License
-Copyright (c) 2021 gonzalo@x61.sh
+Copyright (c) 2022 gonzalo@x61.sh
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
musashi $ got commit -m "New year"
M LICENSE
Created commit 614d462e936c8ab4098c362952394be481c1e8ff
musashi $ got send
Connecting to "origin" 192.168.0.200
packing 1 reference; 3 objects; deltify: 100%; uploading pack: 1.1K 100%
Server has accepted refs/heads/master
Exciting changes, so I modified "LICENSE" file, I checked what I did with got status, I get a diff of my changes with got diff, and then commit it to my local repo with got commit -m "New year" in a oneliner, because pro are like this, after that I sent the changes to my GoT server with got send.
I want to keep such a big change in sync everywhere in case something happens to my server at home, so since we have so many options of providers, I will configure my Codeberg, Sourcehut and Github accounts to get the changes from my GoT server, for this, you need to create an empty repo on each one of those providers, in my case is ansible-role-mailserver, after that we need to configure our got.conf(5) inside our git-repository(5) (~/got/ansible-role-mailserver.got)
musashi $ cat ~/got/ansible-role-mailserver.got/got.conf
author "gonzalo <gonzalo@openbsd.org>"
remote "origin" {
server 192.168.0.200
protocol ssh
repository "/open/git/ansible-role-mailserver"
branch { "master" }
}
remote "github" {
server git@github.com
protocol ssh
repository "gonzalo-/ansible-role-mailserver"
branch "master"
}
remote "codeberg" {
server git@codeberg.org
protocol ssh
repository "gonzalo/ansible-role-mailserver"
branch "master"
}
remote "sr.ht" {
server git@git.sr.ht
protocol ssh
repository "~gonzalo/ansible-role-mailserver"
branch "master"
}
musashi $ cd ~/got/ansible-role-mailserver.got
musashi $ got fetch -q
musashi $ got send -T -f -q github
musashi $ got send -T -f -q codeberg
musashi $ got send -T -f -q sr.ht
I am assuming that you have your pub ssh key added to all those providers, so the above commands should run smoothly, refreshing the websites of these providers will show the repos synchronized.
We installed gotweb so if we want a nice web interface to see our work, I suggest you to read the man which is quite easy and straightforward, of course you have httpd(8) already running so we just need to include the chunk from the man, and then enable slowcgi(8)
# cat /etc/httpd.conf
server "default" {
listen on * port 80
location "/.well-known/acme-challenge/*" {
root { "/acme" }
request strip 2
}
location "/cgi-bin/*" {
root "/"
fastcgi
}
location "/*" {
directory index "index.html"
}
root "/htdocs/gotweb"
}
types {
include "/usr/share/misc/mime.types"
}
# rcctl enable httpd slowcgi
# rcctl start httpd slowcgi
That is all, I let you investigate the rest, a good start could be reading gotweb.conf(5).
Have fun!