What is the easiest way to have a self hosted git server?
from ZeDoTelhado@lemmy.world to selfhosted@lemmy.world on 16 Sep 19:05
https://lemmy.world/post/36019018
from ZeDoTelhado@lemmy.world to selfhosted@lemmy.world on 16 Sep 19:05
https://lemmy.world/post/36019018
I’ve been recently dabbling on rust, and I am have been mostly doing that on my laptop. However, I also have a desktop and once in a while I would like to resume my stuff from the laptop, but without manual file transfers.
I know git by design does this, but I would like to use my current docker setup with Ubuntu server to have a very simple git server.
What would be the simplest git server to have in this situation? Keep in mind I am not planning to expose none of this to the internet
threaded - newest
Using git is oftentimes a good idea but does not fit your description. Just use syncthing or another cloud thing. You can still use git but without a dedicated berg/tea/hub/lab/bucket server
Horrible idea. You’ll likely end up syncing a mess of unnecessary, incompatible and conflicting binary build files onto different platforms, you’ll end up with internal file conflicts that are impossible to properly resolve and will destroy your repo, especially if you’re still using git on top of it. Don’t do this. Git has its own synchronization mechanisms for a reason, they are extremely mature and specifically designed for maximum efficiency, safety and correctness for the task at hand, which is managing source code. Millions of people use git for source code every day. It is a solved problem.
Syncthing is literally the WRONG tool for this job. It is a great tool for many situations, but you are using it as a hammer when what you need is a saw.
To be fair, if you want to sync your work across two machines, Git is not ideal because well, you must always remember to push, If you don’t push before switching to the other machine, you’re out of luck.
Syncthing has no such problem, because it’s real time.
However, it’s true that you cannot combine Syncthing and Git. There are solutions like github.com/tkellogg/dura, but I have not tested it.
There’s some lack of options in this space. For some, it might be nicer to run an online IDE.
…
To add something, I second the “just use Git over ssh without installing any additional server”. An additional variation is using something like Gitolite to add multi-user support to raw Git, if you need to support multiple users and permissions; it’s still lighter than running Forgejo.
SSH is all you need. You can clone directly from one .git directory to another.
e.g
The really simple setup for a single user is just a SSH server with access to storage and the git command. Assuming your laptop and desktop have SSH access to
server
, you can just:and then
git clone server:somerepo
.For something slightly higher-tech, I recommend going with Forgejo (the fork of Gitea). It is really easy to set up and low maintainance.
Avoid GitLab for small setups, it is fairly resource hungry.
This is the correct answer
For something more than bare got and lower than forgejo I can recommend soft-serve
.
This is not the simplest answer at all but FYI you can also self host gitlab
The simplest (really the simplest) would be to do a
git init --bare
in a directory on one machine, and that way you can clone, push or pull from it, with the directory path as URL from the same machine and using ssh from the other (you could do this bare repo inside a container but really would be complicating it), you would have to init a new bare repo per project in a new directory.If a self-hosted server meaning something with a web UI to handle multiple repositories with pull requests, issues, etc. like your own local Github/Gitlab. The answer is forgejo (this link has the instructions to deploy with docker), and if you want to see how that looks like there is an online public instance called codeberg where the forgejo code is hosted, alongside other projects.
Check out Gitea. It was pretty easy to set up with docker and they have pretty decent docs.
gitea has been replaced by forgejo
You are correct, and I am still a bit sad about it, because gitea was a cuter name and logo TBH. But Forgejo is pursuing a technically superior design and socially better path at this point.
Why is that? The project still seems to be available / updating
it's been forked Into forgejo a community driven fork if you don't care that they are community based, they are also implementing federation
I think Forgejo is a community-driven fork of Gitea. Gitea development is still active.
Look at the number of commits
Churn != Improvement
Not necessarily
Notice Forgejo is being hosted on Forgejo. The community behind it is much stronger while Gitea is some startup that is desperately trying to be relevant.
forgejo is implementing federation and gitea is not https://forgejo.org/compare-to-gitea/ if you dont care that its community based, federation is the only thing i could tell you
If you fancy a nice webbased interface, Forgejo. Git bare with cgit is an option of course, but running the single application for Forgejo will you lots of fun.
git init --bare
And then just ssh to the server to push/pull. It can’t be any simpler
I’ve played with Gitea a little and it was easy to set up, but I didn’t need the web stuff. So as others have suggested, I just set up a bare git repo in one place, then git clone it over ssh in the other place, and push and pull to it. So that’s an SVN-like model with a central repo, plus a few other places using it and sometimes pushing code to it that I manually pull when needed to the others.
All this stuff with docker containers seems like ridiculous overkill.
I have a private instance of Forgejo in docker on my server. took me all of 5 minutes to set up. I did this only because I wanted a web based GUI for some stuff.
this.
Many excellent replies. Just want to add github.com/charmbracelet/soft-serve as an option
Do you have any experience with it? I am curious about it and wonder how is the usability in its current state. I have not seen any independent review or feedback about it yet.
Happy to oblige your request stranger.
Softserve is perfectly usable, especially if your needs are more basic (its for you, no need for PRs, etc). The only gotcha is you’ll need a ed55219 key to use it.
It has been stable for me the last few years I’ve known about it. Ive run it as a container of some sort for that entire time. It’s definitely still maturing though, with more features added semi frequently.
I use it for literally everything I want self hosted, which is like 7-8 git repos for different things.
I use forgejo on a raspberry pi.
Second Forgejo. Easiest deploy I’ve ever done.
I use Forjego, and it's not exposed to the Internet.
Forgejo
X 100
Forgejo my beloved 🥰🥰