G
build a git remote server
Experiment Preparation:
CentOS 6.5 x64 warehouse
CentOS 6.5 x64 online Application Server
Win7 Local developer PC
1.linux install git
Yum-y Install git
2.Create a directory where git files are stored
Mkdir-pv/data/git
3. Create a git user
Useradd Giter
echo ' 123456 ' | passwd--stdin Giter
4. Switch to giter user and create key
Su-giter
SSH-KEYGEN-T RSA All-way return
5. Download the key pair to Win7 and store the public key to the Giter user
SZ id_rsa*
Cat ' ~/.ssh/id_rsa.put ' >> Authorized_keys
Modify permissions, or you will not be able to log in
chmod. SSH
chmod. Ssh/authorized_keys
6. Test using key login Giter
You also need to modify the sshd_config before logging in , modify the following items.
Vi/etc/ssh/sshd_config
Rsaauthentication Yes
Pubkeyauthentication Yes
Authorizedkeysfile.ssh/authorized_keys
This item is modified at last (no password login)
Passwordauthentication No
650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M01/71/01/wKioL1XDOnjwmeyAAAIXH7FrJZI269.jpg "title=" QQ picture 20150806183500.png "alt=" Wkiol1xdonjwmeyaaaixh7frjzi269.jpg "/>
7. Build warehouse in Server directory (su-giter)
Cd/data/git
Git init--bare 3899w.git
chmod-r775 3899w.git
8 , win7 clone warehouse to local, here I am using Tortoisegit
Clone Address: Ssh://[email protected]:/data/git/3899w.git
650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M00/71/01/wKioL1XDOonQ3TqYAAGpnl6xWRc056.jpg "title=" QQ picture 20150806183511.png "alt=" Wkiol1xdoonq3tqyaagpnl6xwrc056.jpg "/>
here the remote server is basically done, but generally this is just a warehouse, if you need to publish to each application server need to use Web App tools to submit on-line interface.
we're not going to introduce you here. Web App, but you can set up the online command line to submit online
the next step is to operate on the application server ( requires an online code of the user wwwgit- himself to create )
1 , installation git
Yum-y Install git
2 , generating a key pair
SSH-KEYGEN-T RSA
3 , upload the public key to Giter Server (upload required here Giter password, which is why the front Giter password, and the reason for allowing login)
Ssh-copy-id-i ~/.ssh/[email protected]
4 , test no password login Giter
[Email protected]
5 , after success, you can Clone Warehouse code to Application server app as online code
Gitclone Ssh://[email Protected]:/data/git/3899w.git
6 , and finally remember that changes cannot be used. Giter Account Login Server
vim/etc/passwd
/bin/bash->/usr/bin/git-shell
In this process, there may be some need to modify directory permissions, and then directly to the relevant directory owner and permissions to modify such
Warehouse Server
Chown-r Giter.giter/data/git
Chmod-r 775/data/git
Application Server
Chown-r www.wwwgit/data/www
Chmod-r 770/data/www
1
This article is from the "track to record work learning" blog, so be sure to keep this source http://stephenliu.blog.51cto.com/6470474/1682371
Remote GIT server recommended