How to use GIT on Client side (Through SSH)

来源:互联网 发布:php interface 编辑:程序博客网 时间:2024/05/16 05:43

1. Setup GIT

1.1

# sudo vim /etc/hosts

Add line:

 192.168.0.243 my-git-server

 

1.2

# git config --global user.name "steven"

# git config --global user.email "steven.liyong@gmail.com"

# git config --global color.ui auto

 

1.3

Create ssh id_rsa file from server

 

1.4

# sudo cp id_rsa ~/.ssh/   

# sudo chmod 666 ~/.ssh/id_rsa

# eval 'ssh-agent'  (or ssh-agent bash)

# ssh-add ~/.ssh/id_rsa

 

2.1

# sudo vim ~/.ssh/config

Add lines:

Host my-git-server

User steven

 

2.2 (option)

# ssh my-git-server  <--- check whether you can ssh the git server without password

# exit  

                       

3.

3.1 Get/Create branch for local fix

# mkdir -p ~/work/git

# git clone ssh://git-my-server/git/development/smartq7.git

# cd smartq7

# git branch

# git checkout -b smartq7-master origin/smartq7-master)

 

3.2 Modify the local src code, for example

#vim testsrc.h

 

3.3 Commit local src code to my-git-server

#git add testsrc.h

#git commit -m "Just for test"

#git push

 

3.4 Create tag on my-git-server

#ssh my-git-server

#cd /git/development/smartq7.git

#git tag TEST_TAG_20100318 smartq7-master

 

DONE!

原创粉丝点击