Register for the iXsystems Community to get an ad-free experience and exclusive discounts in our eBay Store.

Create GIT Server in IOCage Jail - In a few easy steps

Sean Hasson

May 27, 2018
Setting up Git Server On FreeNas Jail

Taking some time to share this tried and tested approach *I Took* in order to set-up GIT Server on Jail..
In my implementation I used a zfs mountpoint so that I could have a working code base on a separate disk /pool and also for backup.
Also you will need to setup and enable ssh on your jail - (not covered here)
There are posts for this so not covered here..


Example Pre-Req:

  • Jail Setup as my Git Server -> e.g
  • Create a user on Git Server -> e.g SeanHasson and enable ssh
  • Install Git ->
    pkg install git-2.22.0
  • * Note: Particular Version of GIT - do a
    pkg search git
    for repo list

Step one in my approach is to setup a SSH key on your server so "as a developer" you dont have to keep inputing your password for checking in etc..

So assuming ssh setup on your GitServer Jail

1.Setup SSH Private Key
On Local Machine
(Leave all options blank and generate key into id_rsa)​
(In my case I Don't generate passcode unless you want to keep being prompted - locally)​

2. Copy Private key to you Git server

ssh-copy-id SeanHasson@

  • This will copy your private key to /.ssh/ directory
  • Verify - log on to your Git Server in new tab
  • Verify @ ~/.ssh/ inside should see keys for user

3. Next Test can log in from Local Machine

ssh SeanHasson@​

(Should log in without password)​

4. Create our first Git Repo directory.

So given we are ssh'd on to our Server​
Create a new Repository and init it as a working master (This can be done in different ways - this is the way I did it)​
mkdir /repos/MyProject.git​
cd /repos/MyProject.git​
git init --bare​

5. Need to setup Git Local If Now Already done///
So if your on Ubuntu or similar
Exit Server or Switch to new Tab (On Local Machine)​
sudo apt install git​

6.Setup your local config
So set up your user/email locally e.g
git config Sean Hasson​
git config​

7.Clone a working directory local
Next clone a working directtoy on your local machine by cloning the created repo​
mkdir MyWorkingDirectory​
cd MyWorkingDirectory​
git clone ssh://SeanHasson@​

* It will give a warning about cloning an empty repository...​

8. Commit Something to Start
  • If everything worked you should be able to do something as follows
  • next Add Something to empty Repository and commit
  • The clone should have set remote origin master
Do a
git branch
to see branch - should be set to master​

#Navigate to your project repo...​
# Create a file ""​
cd MyProject​
~/MyWorkingDirectory/MyProject> touch​
git stage *​
git commit -m "First Commit"​
git push​

9. All DOne

So at this point you should be able to do git pull etc..​
Create a Development Branch and you are off...​
----Tracked Origin​
# git checkout -b "development"​
# ....​
Hopefully helps :)​