git setup


git setup

git server ip : 192.168.1.49

git project dir: /home/git/WebProject/ErpRepo

branch : MasterForms

create git project directory on git server.

root@gitserver ~# mkdir -p /home/git/WebProject/ErpRepo

ErpRepo directory created on an under WebProject directory

root@gitserver ~# cd /home/git/WebProject/ErpRepo

change directory to ErpRepo

root@gitserver ErpRepo# git init –bare

This directory convert in to bare. Use a non-bare repository to work locally and a bare repository as a central server/hub to share your changes with other people. (git init –bare)

==============================================================================

Howto repo push into server ?

Basic setup for every git client (first time)

create git project repo directory on local machine .

user@localhost user$ mkdir Erplocal

create directory on your local machine.

user@localhost user$ cd Erplocal

change to Erplocal directory.

user@localhost Erplocal$ git init

initialized git in local directory.

user@localhost Erplocal$ git config –list

check config list.

user@localhost Erplocal$ git config –global user.name “Yogesh Jadhav”

add user name into git.

user@localhost Erplocal$ git config –global user.email “yogeshyj@kesari.in”

add user email address into git.

user@localhost Erplocal$ git config –list

user.name=Yogesh Jadhav

user.email=yogeshyj@kesari.in

Project push from client to git server (first time)

After create basic git basic setup then move to next step for create project

user@localhost Erplocal$ touch index.php

create file into Erplocal directory

user@localhost Erplocal$ git init

git initialized

user@localhost Erplocal$ git add index.php

git file add file into repo

user@localhost Erplocal$ git commit -m”initialized comment”

Add comment

[master (root-commit) 10bb7c5] first time commited

0 files changed, 0 insertions(+), 0 deletions(-)

create mode 100644 index.php

user@localhost Erplocal$ git branch MasterForms

Create master branch for project

user@localhost Erplocal$ git checkout MasterForms

if already created branch then change to above branch

user@localhost Erplocal$ git remote add origin git@192.168.1.49:/home/git/WebProject/ErpRepo

add remote repo

user@localhost Erplocal$ git remote -v

>check remote repo

origin git@192.168.1.49:/home/git/gitprojects/ErpRepo (fetch)

origin git@192.168.1.49:/home/git/gitprojects/ErpRepo (push)

user@localhost Erplocal$ git push origin MasterForms

>now push your project into server

  • [new branch] MasterForms → MasterForms

project pull from git server to client

user@localhost user1$ mkdir Erpproject

create directory in your local machine.

user@localhost user1$ cd Erpproject

change into project directory.

user@localhost Erpproject$ git init

git initialized

user@localhost Erpproject$ git remote add origin git@192.168.1.49:/home/git/WebProject/ErpRepo

add remote repo.

user@localhost Erpproject$ git remote -v

check remote repo.

user@localhost Erpproject$ git pull origin MasterForms

download MasterForms branch repo.

New file update in your project

user@localhost Erpproject$ echo “This is test line” >> index.php

Add new line in index.php file

user@localhost Erpproject$ git status

>output:

On branch MasterForms

Untracked files:

(use “git add …” to include in what will be committed)

#

Erpproject/

nothing added to commit but untracked files present (use “git add” to track)

user@localhost Erpproject$ git add .

user@localhost Erpproject$ git add -u

user@localhost Erpproject$ git commit -m”this is first time comment”

output:

[MasterForms f80b59c] this is first time comment

1 files changed, 1 insertions(+), 0 deletions(-)

create mode 100644 Erpproject/index.html

user@localhost Erpproject$ git push origin MasterForms

Counting objects: 5, done.

Delta compression using up to 2 threads.

Compressing objects: 100% (2/2), done.

Writing objects: 100% (4/4), 333 bytes, done.

Total 4 (delta 1), reused 0 (delta 0)

To git@192.168.1.49:/home/git/gitprojects/sigma

e874ddb..f80b59c MasterForms -> MasterForms