Installing Git on your server

Try Fast Read

First things first, If you do not know what is GIT… you are missing one of the best revision control system on the internet. It can handle all types of your work, be it programming, designing, or any casual work. Git was initially designed and developed by Linus Torvalds for Linux kernel development in 2005, and has since become the most widely adopted version control system for software development. You do have where you can create public repo or private repo (for a small fee). But if you have your own server/computer, why not have git on your own system?

Install git in your system
(Download the exe in windows, dmg in mac,
for linux

Ubuntu: sudo apt-get install git-core
Fedora: sudo yum install git
Arch: sudo pacman -S git

Then create the following script in your favorite text editor with extension “.sh”,for example

if [ "$#" -eq 1 ]
sudo mkdir $1
cd $1
sudo git init --bare
cd ..
sudo chown git:git $1 -R
sudo chmod 775 -R $1
echo "Created git repo for $1"
echo "You can clone the repo using git clone [email protected]:$1"
echo "or you can add your codes to repo using git remote add origin [email protected]:$1"
echo "Please pass the filename"

and run it in your gitbash/terminal via

sh gitdirname

If you get a permission error, you can run

sudo chmod a+w

the cloning or add repo url is of format


You can learn about adhoc sharing of git repo from here

Post navigation