Tech TLDR;

  • Archive
  • Top Posts
  • GitHub
  • LinkedIn
  • Contact

Private Git Repository on Any Computer

March 3, 2017 by admin

Table of Contents

  • On git server
  • On client (any computer that will be pulling/pushing code)
    • First commit
  • Testing the repo
  • Final thoughts

With popularity of Github and many other competing offerings, it’s easy to overlook how simple it is to set up (unlimited) private repos on any network connected computer.

For example, I run this blog on a cheap instance of Linode, where $5 a month get’s you 20Gb SSD storage.

But you don’t have to pay anything. During my start up days back in 2012 we had an old gaming box connected to internet, that served as our “unlimited” private git server.

All is needed to set it up is:

On git server

ssh demo@demoserver.com # Would be your username and server url here
cd /home/demo/ # Some location accessible by all users with ssh access
mkdir demo.git # Create new repo
cd demo.git
git init --bare # Initialize git
Code language: PHP (php)

On client (any computer that will be pulling/pushing code)

git clone ssh://demo@demoserver.com:/home/demo/demo.git
cd demo/
git status -s
Code language: PHP (php)

Note that it’s just like regular scp command. With ssh:// being protocol, demo username, demoserver.com site’s URL, and home/demo/demo.git location of the git repo.

First commit

vim README.md 
git add .
git commit -m 'First commit'
git push
Code language: JavaScript (javascript)

Now the private repo has the README.md file committed.

Testing the repo

cd ~/Desktop/
mkdir deleteme
cd deleteme/
git clone ssh://demo@ademoserver.com:/home/demo/demo.git
cd demo
git log
Code language: JavaScript (javascript)

You should see the First commit in log.

Final thoughts

This approach will not provide “Pull Request” management or issue tracking. If those features are desired, I would recommend looking into an open-source self-hosted solutions like Gitlab.

That being said, as someone who likes to use the command line and hack away on small projects (keeping some of them private), I find the outlined approach to be sufficient for 80% of my use cases.

Filed Under: Git Tagged With: git

Copyright © 2025 · eleven40 Pro Theme on Genesis Framework · WordPress · Log in