Setup GIT Repository in Ubuntu VPS

Setup GIT Repository in Ubuntu VPS

In this blog, we will setup git repository in Ubuntu VPS. We are going to follow these steps:

  1. Create a git user in Ubuntu server
  2. Setup authentication for a developer
  3. Append developer SSH public key in .ssh/authorized_keys file
  4. Create a empty git repository
  5. Clone a empty git repository in local system
  6. Add sample file
  7. Push latest change to the git repository
  8. View git log

Connect to Ubuntu server via SSH


ssh root@

It will ask you to enter password, type password and press enter key.

Install GIT

We have to install git. Before installation we need to check git is already installed or not.

git --version

We can see, git is already installed in Ubuntu 20.04 server. So no need to install.

Create git user

The command "sudo adduser git" will create a new git user and a new git group. It will ask you to type password for git user, type password and press enter. Again retype password then press ente. For other values press enter, ifyou don't want to change.

sudo adduser git

We have successfully created the git user and group.

Setup for authenticating user

Go to git home directory

cd /home/git/


Change user root to git

su git

Create a .ssh directory and give permission

mkdir .ssh && chmod 700 .ssh


Create authorized_keys file inside .ssh directory and give permission

touch .ssh/authorized_keys && chmod 600 .ssh/authorized_keys

cd .ssh


Add some developer SSH public keys to the authorized_keys file

I will add my SSH public keys to the authozized_keys file.

Open command prompt in your local system and get the SSH public key

cd .ssh



Copy the key and paste in server's authorised_key file

Make sure you are in /home/git/.ssh folder.

vi authorized_keys

It will open vi editor, press "i" to insert then paste the SSH public key.

Save and exit vi editor.

Create git repository

Create directory for git repositories in /home/git

In this example, i am creating git repository inside /home/git/git_repositories/ folder. You can create git repository directly in /home/git/ directory also, but i would not recommend to do that. So creating git_repositories directory.

cd /home/git

mkdir git_repositories

cd git_repositories

Create directory for git repository

mkdir project1.git

cd project1.git

Initialize bare git repository

git init --bare

Clone empty git repository in your local syatem

We have created the git repository in Ubuntu VPS. Now we have to clone in my local system.

Open command prompt and go to project diretory

I want to clone repository in G:/projects/git-repos in this directory. You can clone git repository according to your project directory.

cd G:/projects/git-repos

Clone git repository

You have to use git clone command to clone the git repository. You have to use your server IP and path of git repository.


git clone git@

We have successfully cloned the git repository in my local system. We can see in window explorer also.

Add sample file in git repository

Let us add one sample file. I have added test.txt file...

Push latest changes to the GIT repository

Open command prompt in you local system. Go to project folder and run following commands.

cd G:\projects\git-repos\project1

git add --all

git commit -m "Added test.txt file by nutan"

git push origin master

We can see without any error, we have pushed latest chanes to the git repository. Now we will check git log or status in server and local system.

View git log in local system

git log

View git log in server

Connect to the server, go to the git repository directory and view git log.

cd /home/git/git_repositories/project1.git

git log

It is showing latest commit log.

Machine Learning

  1. Deal Banking Marketing Campaign Dataset With Machine Learning


  1. Difference Between Scalar, Vector, Matrix and Tensor
  2. TensorFlow Deep Learning Model With IRIS Dataset
  3. Sequence to Sequence Learning With Neural Networks To Perform Number Addition
  4. Image Classification Model MobileNet V2 from TensorFlow Hub
  5. Step by Step Intent Recognition With BERT
  6. Sentiment Analysis for Hotel Reviews With NLTK and Keras
  7. Simple Sequence Prediction With LSTM
  8. Image Classification With ResNet50 Model
  9. Predict Amazon Inc Stock Price with Machine Learning
  10. Predict Diabetes With Machine Learning Algorithms
  11. TensorFlow Build Custom Convolutional Neural Network With MNIST Dataset
  12. Deal Banking Marketing Campaign Dataset With Machine Learning


  1. How to Parallelize and Distribute Collection in PySpark
  2. Role of StringIndexer and Pipelines in PySpark ML Feature - Part 1
  3. Role of OneHotEncoder and Pipelines in PySpark ML Feature - Part 2
  4. Feature Transformer VectorAssembler in PySpark ML Feature - Part 3
  5. Logistic Regression in PySpark (ML Feature) with Breast Cancer Data Set


  1. Build the Neural Network with PyTorch
  2. Image Classification with PyTorch
  3. Twitter Sentiment Classification In PyTorch
  4. Training an Image Classifier in Pytorch

Natural Language Processing

  1. Spelling Correction Of The Text Data In Natural Language Processing
  2. Handling Text For Machine Learning
  3. Extracting Text From PDF File in Python Using PyPDF2
  4. How to Collect Data Using Twitter API V2 For Natural Language Processing
  5. Converting Text to Features in Natural Language Processing
  6. Extract A Noun Phrase For A Sentence In Natural Language Processing