Folks,

I’m looking for a self-hosted GitHub alternative that I can just plop into Portainer as a docker-compose and get working.

My main interest is in something that sort of works with GitHub - if there’s a way I can pull repos from GitHub into this self-hosted git using a webUI and maybe even push my changes to repos on GitHub, that would be nice. I’m not hard-and-fast on this though as this is mostly an experiment right now and I don’t know why I need this.

What are you folks using to host your super secret local code and why?

  • Anafroj@sh.itjust.works
    link
    fedilink
    English
    arrow-up
    44
    ·
    edit-2
    1 year ago

    Obligatory check : are you sure you really need a forge? (that’s the name we use to designate tools like Github/Gitlab/Gitea/etc). You can do a lot with git alone : you can host repositories on your server, clone them through ssh (or even http with git http-backend, although it requires a bit of setup), push, pull, create branches, create notes, etc. And the best of it : you can even have CI/CD scripts as post-receive hooks that will run your tests, deploy your app, or reject the changes if something is not right.

    The only thing you have to do is to create the repos on your server with the --bare flag, as in git init --bare, this will create a repos that is basically only what you usually have in the .git directory, and will avoid having errors because you pushed to a branch that is not the currently one checked. It will also keep the repos clean, without artifacts (provided you run your build tasks elsewhere, obviously), so it will make all your sources really easy to backup.

    And to discuss issues and changes, there is always email. :) There is also this, a code review tool that just pop up on HN.

    And it works with Github! :) Just add a git remote to Github, and you can push to it or fetch from it. You can even setup hooks to sync with it. I publish my FOSS projects both on Github and Gitlab, and the only thing I do to propagate changes is to push to my local bare repos that I use for easy backups, they each have a post-update hook which propagates the change everywhere it needs to be (on Github, Gitlab, various machines in my local network, which then have their own post-update hooks to deploy the app/lib). The final touch to that : having this ~/git/ directory that contains all my bare repos (which are only a few hundred MB so fit perfectly in my backups) allowed me to create a git_grep_all script to do code search in all my repos at once (who needs elasticsearch anyway :D ) :

    #!/usr/bin/env bash
    # grep recursively bare repos
    
    INITIAL_DIR=$(pwd)
    for dir in $(find . -name HEAD -exec dirname '{}' \;); do
      pushd $dir > /dev/null
      git grep "$*" HEAD > /dev/null
      if [[ "$?" = "0" ]]; then
        pwd
        git grep "$*" HEAD
        echo
      fi
    
      popd > /dev/null
    done
    

    (note that it uses pushd and popd, which are bash builtins, other shells should use other ways to change directories)

    The reason why you may still want a forge is if you have non tech people who should be able to work on issues/epics/documentation/etc.

  • 𝘋𝘪𝘳𝘬@lemmy.ml
    link
    fedilink
    English
    arrow-up
    39
    arrow-down
    1
    ·
    1 year ago

    Have a look at Forgejo which is a soft fork run by a nonprofit organization of Gitea which is owned by a for-profit company.

    https://forgejo.org/

    It need very little system resources and still gives you all the common features you know from commercial Git hosting providers.

    And yes, you can mirror existing Git repos using a web UI.

    • Cam@lemmy.world
      link
      fedilink
      English
      arrow-up
      9
      arrow-down
      2
      ·
      1 year ago

      I also recommend forgejo. They are also working on adding a federation feature to forgejo just like Lemmy has!

    • onelikeandidie@lemmy.world
      link
      fedilink
      English
      arrow-up
      5
      arrow-down
      1
      ·
      1 year ago

      I also recommend forgejo, I’ve been using it for a while for my personal projects and the ui is still beautiful while being a simple git server at the same time.

      • nebs@lemm.ee
        link
        fedilink
        English
        arrow-up
        1
        ·
        1 year ago

        Why instead of gitea though? I thought the “for profit” stuff was only to provide the original developers of gitea the ability to provide paid support to commercial clients.

          • fnv@lemmy.ml
            link
            fedilink
            English
            arrow-up
            1
            ·
            edit-2
            1 year ago

            Heh, I was running linux with docker on top of Trunas for several months because of Jellyfin was not available to run in jail. I was not happy because it wasted the server resources and also my resources to maintain it. I don’t want go such way again.
            Happy running gitea in jail and when forgejo will be also available in jail I will probably move to its.

    • herrvogel@lemmy.world
      link
      fedilink
      English
      arrow-up
      4
      ·
      edit-2
      1 year ago

      And is hilariously overkill for what OP seems to want. It’s a pretty large and heavy package that comes with a whole lot of (for OP unnecessary) features.

    • melchiorbv@lemm.ee
      link
      fedilink
      English
      arrow-up
      1
      ·
      1 year ago

      I self-host Gitea and is pretty lightweight and low maintenance. Great solution!

    • krnl386@lemmy.ca
      link
      fedilink
      English
      arrow-up
      6
      ·
      1 year ago

      That’s a pretty hefty solution. Gitlab is a monster nowadays…

      GOGS, Gitea/Forgejo can do 90% of what Gitlab does and are much lighter.

  • unscholarly_source@lemmy.ca
    link
    fedilink
    English
    arrow-up
    5
    ·
    1 year ago

    Gogs and Gitea are git alternatives that offers GitLab features with less system resource demands.

    Though, it would be good to understand your use case, whereby a GitHub private repository would not be suitable…

  • mholiv@lemmy.world
    link
    fedilink
    English
    arrow-up
    4
    ·
    1 year ago

    +1 For Gitea. Works really well for me. It recently added GitHub style actors so you can use GitHub style CI/CD too!

  • Aux@lemmy.world
    link
    fedilink
    English
    arrow-up
    4
    ·
    1 year ago

    Why do you want that? Plain git can do everything you actually need.

  • nbafantest@lemmy.world
    link
    fedilink
    English
    arrow-up
    3
    ·
    1 year ago

    I’d probably just run gitlab and use the gitlab images, as that’s one of the solutions git recommends