Philip P. Ide

Author, programmer, science enthusiast, half-wit.
Life is sweet. Have you tasted it lately?

User Tools

Site Tools


blog:blog:repomirror

Mirroring Repos

I've recently installed Forgejo on one of my intranet servers. If you don't know what this is, a quick explanation:

  1. Forgejo is a private git repository hosting service very similar to GitHub
  2. GitHub is a public git repository hosting service
  3. a 'repository' is a software project storing source code and version control information

How git Works

Git was created by Linus Torvalds during the early stages of the Linux kernel development to replace existing version control software. Traditionally, a software repository would be created centrally (on a network) and programmers would 'book out' a source file to edit. Nobody else could book it out to edit it until the first person returned it to the repository (booking it back in).

What git does, is it gives everyone a complete copy of the entire repository, and when they've completed an edit (or series of edits), they commit changes to their local repository, then push changes up to the central repo. Other members of the team can 'pull' the changes down to update their private versions of the repo. If there is a clash (e.g. two people have edited the same file), git tells you what needs to be rectified so a merge can be made.

GitHub

GitHub set itself up as a place where anyone can host a repo for free, and is the most widely used place for hosting public repositories for FOSS (free (as in libre not beer) and open source software) projects. I have a modest number of projects hosted there (~10 at the time I write this).

Because of the way git works, I have a local repo of each of my projects, each replete with full version history of every commit, so I can roll back to any previous commit should I feel the need. However, it's always good to have a backup, right? For this reason, I installed ForgeJo, which is a locally hosted version of GitHub, which sits on one of my intranet servers.

When I commit a change, I can push (it's OK to wait a few commits before 'push'ing) the changes up to ForgeJo.

Today, I took that a stage further. I added a hook to a ForgeJo repository, so when I push a change up to it, it automatically updates a repository of the same name on GitHub, which has two benefits:

  1. There is now an off-site backup of the repo as well as a network backup
  2. The repo and the source it contains becomes publicly available (although I can still mark the repo private)

It turned out to be simplicity itself to do this. The ForgeJo documentation is superb in this regard.

This website uses cookies. By using the website, you agree with storing cookies on your computer. Also you acknowledge that you have read and understand our Privacy Policy. If you do not agree leave the website.More information about cookies

Discussion

Enter your comment:
I I X M V
 
blog/blog/repomirror.txt · Last modified: 2024/07/17 17:53 by Phil Ide

Except where otherwise noted, content on this wiki is licensed under the following license: Copyright © Phil Ide
Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki