
Developers all over are familiar with the various Version Control systems available. Most developers would have used SVN, Git or Visual SourceSafe over the years at work or personally. The most popular Version Control service, GitHub has thousands of users and repositories available.
Just ask yourself if
- Made a change to code, realised it was a mistake and wanted to revert back?
- Lost code or had a backup that was too old?
- Had to maintain multiple versions of a product?
- Wanted to see the difference between two (or more) versions of your code?
- Wanted to prove that a particular change broke or fixed a piece of code?
- Wanted to review the history of some code?
- Wanted to submit a change to someone else’s code?
- Wanted to share your code, or let other people work on your code?
- Wanted to see how much work is being done, and where, when and by whom?
- Wanted to experiment with a new feature without interfering with working code?
and you can see why having a Version Control system is important.
GitHub is one of the most popular Version Control in the market because it comes with support for a built-in Wiki for hosting documentation and a built-in bug tracker for any issues that crop up. However, there might be code that you’re working on that is sensitive or you just don’t want to have your code exposed to the public. In this case, having your own person Version Control is highly encouraged. Enter Gogs. I’m aware of the fork of Gogs to Gitea and they both have similar functionalities. The instructions below work for both but I use Gogs personally.
To make it easy for using Gogs, ensure the mDNS client is installed on Windows so the Raspberry Pi can be accessed using it’s .local
domain. This way you don’t need to remember the IP address of the Raspberry Pi in advance. The mDNS service is automatically set to run in the new Raspbian Jessie & Stretch.
Gogs Service
For this example I’m using Raspbian Stretch but it works on on Raspbian Jessie or ArchLinux as well. The following commands are executed as a non-root user.
- Download the latest Gogs (or Gitea) package for Raspberry Pi (arm). For Gogs, version 0.11.4 is the latest at the time of this writing. Replace the version with the latest version from their website.
wget -c https://dl.gogs.io/0.11.4/raspi2_armv6.zip
- Extract the newly downloaded package
unzip raspi2_armv6.zip
- (Optional) Move the gogs folder to a new location with more storage. I keep my data on an externally mounted Hard Disk drive.
- Change to the directory containing the Gogs files
cd gogs
- Run Gogs web ui
./gogs web
- Now launch your browser and enter the URL to the Gogs Web UI. The default port for Gogs is 3000 so enter
http://<raspberrypi hostname>.local:3000/
. For a first time run, there will be a configuration screen presented. Enter the details as you see fit but here are a few tips to get you started- Database type:
SQLite
, much lighter on the Raspberry Pi - Repository Root Path:
/path/to/external/disk/gogs-repositories
, better to store this on the external disk - Run User:
non-root user
, I use my usual account used to log in as this user. - Domain:
raspberrypi.local
, replace raspberrypi with the hostname of your own Raspberry Pi. This is used for SSH cloning in Git. - SSH Port: Leave this as
22
if you did not change your SSH port otherwise use that port number instead. It is highly advisable to change your SSH port to something else. - HTTP Port:
3000
is fine, we can enable HTTPS on this port later. - Application URL:
<raspberrypi hostname>.local:3000
. This is used for HTTP(S) cloning.
- Database type:
- If you want email from Gogs, configure the necessary email parameters.
- If you want people to register for using your repository, check the Enable Register Confirmation box.
- Check the Enable Mail Notification so people in the various repositories will get email notifcations.
- For Server and Other Services Settings, choose the following for better experience
- Check the Enable Offline Mode box.
- If you don’t want others to create their own accounts, check the Disable Self-registration box.
- I don’t want anyone to view my repositories, so I check the Enable Require Sign In to View Pages.
- Now set the Admin Account Settings. This account will have full access to the whole application. It is recommended to create another account for yourself later.
- Click “Install Gogs” to finish your installation.
Some screenshots of Gogs below
First Install Screen
First Install Screen (Cont.)
