News for hackers. Stuff that matters.
Re:GitHub was down again by Animats on Wednesday July 15, 2020 @02:16PM (#23849315)
What's the easiest way to duplicate all your Github repositories, with history, somewhere else?

Ideally, I'd like to have two synchronized repositories, for no single point of failure, organizational or otherwise.

Re:GitHub was down again by monokh on Wednesday July 15, 2020 @02:23PM (#23849413)
Run git on a personal server[1]? It's not as complicated as you might think. Probably much more usable to setup gitlab.

Then set up the alternative remote on your repos.

[1]https://www.linux.com/training-tutorials/how-run-your-own-gi...

Re:GitHub was down again by rovr138 on Wednesday July 15, 2020 @02:24PM (#23849438)
I posted this on another thread. If you only want the commits, something like this works,

    ssh [email protected]
    mkdir project-1.git
    cd project-1.git
    git init —-bare
    exit
    git remote add alternate [email protected]:project-1.git
All you need is SSH
Re:GitHub was down again by judge2020 on Wednesday July 15, 2020 @02:28PM (#23849496)
All you need to get all commits and all tags/branches:

  git clone --mirror https://github.com/you/repo
Push those to another server:

  git remote add new https://gitlab.com/you/repo
  git push --mirror new
Re:GitHub was down again by kenniskrag on Wednesday July 15, 2020 @02:27PM (#23849475)
I use it also that way. Gitlab does the same if you use ssh. They provide hooks on init so that gitlab knows if something happens.
Re:GitHub was down again by johannes1234321 on Wednesday July 15, 2020 @02:30PM (#23849533)
That's fine for your code repository.

However git has more: - Bug tickets - PR - Wiki - many projects use their githubpages as primary homepage - newly GitHub actions

And then: Often collaborators are only known and identified by their GitHub handle. Running an own server requires some mechanism to identify them again and creating a way to handle their access credentials (ssh key etc.)

Moving a mildly successful project isn't easy. Good if more people plan for that eventuality, even if they stay on GH for the time being.

Re:GitHub was down again by ddevault on Wednesday July 15, 2020 @02:20PM (#23849375)

    git remote set-url --add origin [email protected]:my-project
This will make it so that every time you push to "origin", it'll push twice, to two places. You can repeat this to add a third or more.
Re:GitHub was down again by vorpalhex on Wednesday July 15, 2020 @02:22PM (#23849409)
Gitlab has a feature set for this that's automated but it may be rolled under a paid plan if you want it to be bidirectional.

Building this in git itself is not hard at all, and there's likely a script or plugin for gogs or gitea.

Re:GitHub was down again by ebg13 on Wednesday July 15, 2020 @02:26PM (#23849469)
Other answers talking about using git features are assuming that you don't care about Wiki/PRs/Issues/Labels/etc that are GitHub metadata not part of your repo history.

But GitLab does have feature support for extensive importing and mirroring. https://docs.gitlab.com/ee/user/project/import/github.html (Import your project from GitHub to GitLab) has a section on project mirroring.

Re:GitHub was down again by throwaway744678 on Wednesday July 15, 2020 @02:22PM (#23849404)

    git add remote NAME URL
    git push NAME
It will not transfer GitHub specific content (issues, PE, wiki, etc.), though.
Re:GitHub was down again by kenniskrag on Wednesday July 15, 2020 @02:25PM (#23849442)
git clone ... which you already have

git remote add originFoo URL

git push --all originFoo

There are other flags like mirror but never used them.

Source: https://git-scm.com/docs/git-push

Re:GitHub was down again by jankassens on Wednesday July 15, 2020 @02:21PM (#23849391)
You could probably use GitHub actions to push any commits and branches to GitLab or anywhere else.