BairesDev
  1. Blog
  2. Technology
  3. How to Host Your Software Code Repositories on-Site
Technology

How to Host Your Software Code Repositories on-Site

Even if you only use the self-hosted repository for a portion of your code, you'll be glad you have the option.

Paul Baker

By Paul Baker

Director of Partnerships Paul Baker builds strong business relationships between BairesDev and clients through strategy and partnership management.

6 min read

Featured image

Your developers work tirelessly to generate code to help make your business a success. And given that most software engineers don’t work alone, they probably use a third-party service for versioning and collaboration.

But why depend on a third party to host those code repositories when you can host them on-site? You might be surprised how many tools are available to do just that, and how your business and developers can benefit from making the shift from third-party to in-house repository hosting.

What is a code repository?

If you’re considering an on-site code repository, you probably already understand what a repository is. If not, let’s find out what they are.

You can’t really define a code repository without first understanding versioning. Why? Because one of the primary benefits of using a code repository is that they generally include some form of version control system. What is this? Simply put, version control is a system that keeps track of changes to code. With version control in place, states are saved such that you can always revert back to a previous iteration. 

In other words, if a team member updates the code within the repository in such a way that breaks a certain functionality, you can revert the code back to a previous version (where the code isn’t broken). That’s versioning.

Without versioning, a code repository is just a shared folder that houses code. And you could certainly do that, host a shared directory on a server for your engineers to dump their code into. But that’s not going to be too helpful.

So a code repository is a shared directory on a network that includes a version control system, as well as features like code check out/in, commit changes, and merge code. Of course, some repository systems include more features than others, but they should at least contain that baseline feature set. Essentially, you need a repository that can:

  • Keep your code safe from prying eyes.
  • Offer version control.
  • Enable team members to easily collaborate.
  • Help you prepare your code for production release.
  • Retain information regarding code changes and other analytics.

A code repository doesn’t care if your language of choice is Java, JavaScript, Python, Xamarin, .NET, or Ruby. In fact, you can use a code repository for any programming language.

And now we get to the why.

Why host your own repository?

The question of why can be easily summed up. Your code is key to your company. If that code is proprietary, you might not want to risk anyone seeing it. Third-party systems are bigger targets because they contain a lot of code. If you want to avoid the possibility of your code falling into the hands of hackers who might then use your own code against you, you should seriously consider a self-hosted code repository. 

Self-hosting is also cheaper. If you go with an open-source, free solution, the only thing you’ll pay for is the hardware to host the repository. And considering these solutions can be installed on commodity hardware, that particular cost is generally quite low.

Finally, you don’t have to depend on a WAN connection to work with your repository. Although you probably have a solid network connection to the outside world, when/if that does go down, if your LAN still works, your software engineers can continue working with the repository.

If self-hosting sounds like something you’d like to do, now we get to the how.

How to host your own code repository

There are a number of options available to you. One thing you have to understand, however, is that, when choosing this route, you’re going to have to deploy the repository on your own hardware (or on a cloud-hosted service, such as AWS, Google Cloud, Rackspace, or Linode). And some of the available options aren’t exactly the easiest to deploy. However, once you get that repository up and running it will serve you well.

What are the options? Let’s take a look.

Gitea

Gitea is a great solution for on-premise code repository hosting. It’s free, open-source, lightweight, and fairly easy to deploy. As you might expect, Gitea is a Git server. Git is one of the most popular version-control systems on the planet and was created by Linus Torvalds (the originator of Linux), so you know it’s a reliable system.

Gitea can be installed on any system that supports Go—so Linux, macOS, Windows, and ARM. You can deploy Gita from a simple binary executable, using Docker, or from a platform-specific package. Outside of the standard features, this repository option also includes bug tracking, wikis, and code review.

Gitlab

GitLab is another open-source repository option that offers all of the standard features and adds others like end-to-end encryption, issue tracking, code review, and even CI/CD. GitLab also allows you to access your repositories either from your local LAN or external WAN connections.  GitLab is easy to install and even easier to use. In order to install GitLab, you will need a server with at least two cores and 4GB of RAM.

Unlike Gitea, GitLab can only be installed on Linux (there are also unsupported versions for FreeBSD and macOS). You’ll find two versions of GitLab available: the free Community version and the GitLab Enterprise Edition, which adds features like subgroups, IP address restriction, auditing, compliance management, authentication and authorization, code analytics, DevOps reports, and importers. For GitLab Enterprise Edition pricing, check out their official feature matrix.

GitBucket

GitBucket is a Git web platform that is powered by Scala. This option is easy to install, includes an intuitive user interface, can be extended via plugins, and has a GitHub-compatible API. 

The feature list of GitBucket is impressive. Here you’ll find the typical repository features, with the addition of things like public and private repositories, GitLFS support, repository viewer and online file editor, activity timeline, email notifications, user/group management, and LDAP integration. 

GitBucket can be installed on any platform that supports Java (which is required for installation).

Gogs

Gogs is probably one of the easiest on-premise code repositories you’ll find. This option is cross-platform and can run on any platform that supports Go (so Linux, macOS, Windows, and ARM). 

The Gogs feature set includes the likes of code review, bug tracking, wikis, and private/personal branches. Gogs uses the Git version control system, so it’ll easily integrate into your git-based workflow.

Gogs is open-source, free, and can be run from a single binary, deployed with Docker or Vagrant, or installed via a platform-specific package.

Conclusion

Hosting your own software repository isn’t much of a challenge. And the control you gain over using a third-party solution is worth the effort you’ll put into getting one of these options up and running. And even if you only use the self-hosted repository for a portion of your code, you’ll be glad you have the option.

Paul Baker

By Paul Baker

As BairesDev's Director of Partnerships, Paul Baker helps build strong and long-lasting business relationships with clients by planning strategies, supporting partner strategy execution, enabling sales initiatives, and managing client and marketing partnerships.

Stay up to dateBusiness, technology, and innovation insights.Written by experts. Delivered weekly.

Related articles

how to become an android developer
Technology

By BairesDev Editorial Team

15 min read

Technology - Sanity Testing: Keeping
Technology

By BairesDev Editorial Team

11 min read

Contact BairesDev
By continuing to use this site, you agree to our cookie policy and privacy policy.