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

  • WIPocket@lemmy.world
    link
    fedilink
    English
    arrow-up
    34
    ·
    edit-2
    2 months ago

    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:

    ssh server git init --bare somerepo
    cd somerepo
    git remote add server server:somerepo
    git push --set-upstream somerepo master #(or main)
    

    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.

    • PortNull@lemmy.dbzer0.com
      link
      fedilink
      English
      arrow-up
      4
      ·
      2 months ago

      This is the correct answer

      For something more than bare got and lower than forgejo I can recommend soft-serve

  • Spooky Mulder@twun.io
    link
    fedilink
    English
    arrow-up
    5
    ·
    2 months ago

    SSH is all you need. You can clone directly from one .git directory to another.

    e.g

    git remote add desktop git@desktop:project/.git
    git push desktop main --set-upstream
    
    • sylphio@lemmy.ml
      link
      fedilink
      English
      arrow-up
      0
      ·
      2 months ago

      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.

      • PortNull@lemmy.dbzer0.com
        link
        fedilink
        English
        arrow-up
        3
        ·
        2 months ago

        I use it for my personal projects and its perfectly usuable. If you want people to contribute you’ll just have to do it the old fashioned email patch way. You can use RSA keys but it requires a little fiddling. I’ve used them but needed to massage something. Now I just use ed keys. The SSH ui is perfectly fine. Your repos are stored as bare repos on the server in the configured directory. So they are easily backed up as regular files. It also supporta LFS.

        Let me knownif you have any other questions

  • rozodru@piefed.social
    link
    fedilink
    English
    arrow-up
    3
    ·
    2 months ago

    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.

  • darkan15@lemmy.world
    link
    fedilink
    English
    arrow-up
    3
    ·
    edit-2
    2 months ago

    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.