Wednesday, April 9, 2014

Git-Master Client configuration

First make sure that the git master server and client server are able to connect each other and has proper hostname  set. Also the master and client should be able to access each other with out password.

Making sure that master and client knows each other .

echo "x.x.x.x master.gitserver.com" >> /etc/hosts

echo "x.x.x.x client.gitserver.com" >> /etc/hosts

Setting the Hostname

hostname master.gitserver.com

hostname client.gitserver.com

making sure master and client are able to connect each other with out password

Make use of ssh-keygen and ssh-copy-id to get  this done or you can follow the Blog post http://enekumvenamorublog.wordpress.com/2013/05/17/creating-password-free-connection-between-two-servers-connecting-to-server-a-with-a-private-key/

 

Create a user git in both server and use that user for the process as to keep the security up.

Once this is done ..

Make the Git Repo direcotry..

mkdir /home/git/GIT-Projects

inside that make the needed project name such as proc1

mkdir  /home/git/GIT-Projects.proc1

Intialize the project directory ..

cd  /home/git/GIT-Projects/proc1
[git@master proc1]$ git init --bare

Initialized empty Git repository in /home/git/GIT-Projects/proc1/

[git@master proc1]$


Now at Client



[git@client ~]$ mkdir /home/git/prod1

[git@client ~]$ cd /home/git/prod1

[git@client prod1]$ git init

Initialized empty Git repository in /home/git/prod1/.git/


[git@client prod1]$ git add .

[git@client prod1]$ touch {1..2}

[git@client prod1]$ git add *

[git@client prod1]$ git commit -m "Fist Commit "

[master (root-commit) c1b3efb] Fist Commit

Committer: git <git@client.gitserver.com>

Your name and email address were configured automatically based

on your username and hostname. Please check that they are accurate.

You can suppress this message by setting them explicitly:


git config --global user.name "Your Name"

git config --global user.email you@example.com


If the identity used for this commit is wrong, you can fix it with:


git commit --amend --author='Your Name <you@example.com>'


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

create mode 100644 1

create mode 100644 2

[git@client prod1]$


[git@client prod1]$ git remote add orgin git@master.gitserver.com:/home/git/GIT-Projects/proc1

[git@client prod1]$ git push orgin master

Counting objects: 3, done.

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

Writing objects: 100% (3/3), 208 bytes, done.

Total 3 (delta 0), reused 0 (delta 0)

To git@master.gitserver.com:/home/git/GIT-Projects/proc1

* [new branch] master -> master

[git@client prod1]$


 


git push -u origin master:anotherBranch



No comments:

Post a Comment