Setting Up a self-hosted Git-Server
In this article, we will set up a Git-Server on a NAS available on a local network. For the server we will use Gitea, which we will installed via Docker on a QNAP NAS.
What is Git
Git (not to be confused with GitHub) is a versioning system to enable collaboration within a team. Unlike incremental storage, a versioning system always displays the latest version in the file browser and stores all other snapshots in a database. Git was originally developed by Linus Torvalds and is constantly being developed as an open source project. It is the most widely used versioning system in software development. Platforms like GitHub, or GitLab offer hosting solutions for Git-based projects. GitHub is the largest hosting platform that hosts numerous open source and private projects. Git is also capable of versioning game projects, as it can now work well with large binaries.
Why should I self-host a Git-Server?
Game and animation projects need a lot of storage space to store 3D models, textures and audio data. Platforms like GitHub and GitLab can store this data, but they are designed for software development, which uses less storage space compared to game development. Thus, there are sometimes storage limitations or storage space has to be purchased at a high price. If a team works primarily on-site, a self-hosted Git-Server can be a good alternative. The advantages are saved costs and a faster data transfer on the local network. The disadvantages are the installation and update effort. A locally hosted Git-Server can also be made accessible from outside via https if you want to give remote users access.
The choice of server software
GitHub's server software is proprietary and cannot be used. However, there are many alternatives such as GitLab, Gitea, Bitbucket or Gogs. The most comprehensive system here is GitLab, which can be used free of charge in the form of the Community Edition. It is very well suited for large scalable projects, but consumes a lot of resources. In our case, we will use Gitea, since it is a light weight software and is completely sufficient for QNAP systems with limited CPU and memory. Gitea also offers features such as user management, an issue tracker, a wiki, and various language packs. Gitea is an open source project and is constantly being further developed by a community.
Git for non coders
Installation guide on a QNAP NAS
For simplicity reasons, we recommend to use the namings of folders and settings we are using in this tutorial.
1. Install or upgrade Container Station
Container Station is the service to install Docker containers on a QNAP NAS. Docker Containers are similar to virtual machines and therefore can be easily setup, started, stopped and updated. We will install Gitea as such a Docker Container in the Container Station in the next steps.
- Open your Qnap Web-Interface (default localIpAdress:8080/cgi-bin)
- Navigate to the App Center
- Search for Container Station
- Press Install or Update if it is not already installed in the latest version
2. Create a user for Container Station
In the first step we need to create an account.
3. Create a shared folder
We need a shared folder to store the Gitea application and the database there.
After that, navigate to the new shared folder. You need to create two subfolders, one for the server and one for the database. In the first folder Gitea will store all your large files and in the second folder the database with all meta information from Gitea is stored. You can name the server folder "gitea-server" and the database folder "gitea-postgres".
4. Get user ID (UID) and group ID (GID) of the created user
To get the user id and group id of your newly created user (in this example "dockeruser") we need to connect via SSH (Secure Shell) to the NAS and run a console command. This article explains how to connect to the QNAP NAS via SSH.
Do the following steps:
- Type "Q" and press ENTER
- Type "Y" and press ENTER again
- Type "id dockeruser" and press ENTER again
5. Create Containers in Container Station
Now, copy the following YAML code and paste it into the "YAML" textarea. Keep in mind that the "USER_ID" and the "USER_GID" have to match to the values from step 4. If you used different paths, then you have to adjust them as well.
Change the line "GITEA__database__PASSWD=gitea" and "POSTGRES_PASSWORD=gitea" to a custom password. These passwords need to be the same.
About this compose file
This is a so called compose file which will setup two docker containers
- first gitea from gitea/gitea:latest
- note that under volumes of "server": the first path describes the folder inside the shared folder we created in step 3 (/share/docker-data/gitea).
- second postgres from postgres:13
- note that under volumes of "db": the first path describes the folder inside the shared folder we created in step 3 (/share/docker-data/postgres).
- The containers are set to restart always. So on restart of the QNAP they will automatically start. If they are stopped explicitly via the Container Station they will not restart automatically.
Do the following next steps
- Press "Validate YAML"
- Press "Create"
- Navigate to "Containers" on the left
6. Setup Gitea in Browser
You now have a running gitea instance that can be accessed in your local network from your webbrowser from "http://ip-of-your_nas:3000". Navigate to Gitea in your browser and you will see an initial setup page.
7. Create new user accounts
8. Create a Git repository
- Choose a Repository Name
- Change the Visibility by selecting "Make Repository Private" (if you do not change the visibility everyone that is in your network can see the project in the web browser, even without a user account).
- Set a description and change the other options if you want to.
9. Join the Git Repository in Anchorpoint or any other Git-Client
This video explains how to join a Git Repository in Anchorpoint. Copy the repository url from the website ("http://192.168.178.41:3000/root/tutorial.git" in the example) and use it in the "Join workspace Dialog" in Anchorpoint. Use your account credentials that we setup in Gitea early.
10. Add other users to a project
- Choose the Collaborators tab
- search for the name of the user
- press the add collaborator button
How to enable ACES in Anchorpoint
How to enable ACES color profiles for your OpenEXR files and how to use custom OCIO configuration files.
How to link Notion with your local files and folders
Open the file browser directly from Notion to link your files and folders with a hyperlink. Works for Windows and macOS.