Git / Linux · September 23, 2016 0

Setting up git on local system

Developers often need to set a local git repository or local git server where you can save versions of your code.

Here is a way to go.

Step-1: create git repository on server

We are going to setup git server on local machine. So first need to set the repository.

$ cd /var
$ mkdir git
$ cd git
$ mkdir 
$ cd 
$ mkdir .git
$ cd .git
$ git --bare init

Step-2: Add git server url to your project

Now get back to project directory

$ cd /home/username/ 
$ git init
$ git add --all
$ git commit -m 'first commit'
$ git remote add origin /var/git//.git

Step-3: push your project to git

$ git push -u origin --all