內部開發環境 git代碼託管說明

前言

隨着員工的增長 代碼的開發版本管理 提上了日程。初步計劃:git

1 一臺機器 192.168.1.240 git代碼版本管理centos

2 運行環境 192.168.1.241 內部開發運行環境bash

 

軟件工程師 經過git 天天吧代碼從本地push到 git服務器,git服務器 實時的最新的動態同步到運行環境服務器。服務器

軟件工程師 經過192.168.1.241進行測試代碼測試

 

搭建同步rsync

一鍵搭建安裝rsync包代碼ui

#!/bin/bash
#rsync Written by zhumaohai
#For more information please visit http://www.centos.bz
echo "Please input the rsync username:"
read username
echo "Please input the rsync username password:"
read password
echo "Please input the allow ip address:"
read allowip
echo "Please input the path you want to rsync:"
read rsyncpath
echo "==========================input all completed========================"
echo "==========================install rsync========================"
yum -y install rsync
useradd $username
mkdir /etc/rsyncd
cat >/etc/rsyncd/rsyncd.conf<<EOF
# Minimal configuration file for rsync daemon
# See rsync(1) and rsyncd.conf(5) man pages for help
 
# This line is required by the /etc/init.d/rsyncd script
pid file = /var/run/rsyncd.pid   
port = 873
#address = $serverip
#uid = nobody
#gid = nobody   
uid = root   
gid = root   
 
use chroot = yes
read only = yes
 
 
#limit access to private LANs
hosts allow=$allowip
hosts deny=*
 
max connections = 5
motd file = /etc/rsyncd/rsyncd.motd
 
#This will give you a separate log file
#log file = /var/log/rsync.log
 
#This will log every file transferred - up to 85,000+ per user, per sync
#transfer logging = yes
 
log format = %t %a %m %f %b
syslog facility = local3
timeout = 300
 
[home]   
path = $rsyncpath   
list=yes
ignore errors
auth users = $username
secrets file = /etc/rsyncd/rsyncd.secrets 
EOF
echo "$username:$password" > /etc/rsyncd/rsyncd.secrets
chmod 600 /etc/rsyncd/rsyncd.secrets
cat >/etc/rsyncd/rsyncd.motd<<EOF
+++++++++++++++++++++++++++
+ centos.bz  rsync  2011-2012 +
+++++++++++++++++++++++++++
EOF
/usr/bin/rsync --daemon  --config=/etc/rsyncd/rsyncd.conf
echo "/usr/bin/rsync --daemon  --config=/etc/rsyncd/rsyncd.conf" >>/etc/rc.d/rc.local
ps -aux | grep rsync

客戶端一樣如此spa

客戶端配置密碼文件 不須要用戶名 只要密碼 切記code

/etc/rsyncd/rsyncd.secrets  #只需密碼

同步測試orm

rsync -vzrtopg --progress --delete root@192.168.1.240::home /ranmufei/test/ --password-file=/etc/rsyncd/rsyncd.secrets

客戶端 運行以上代碼同步home模塊的配置 到本地 ranmufei/test/ 目錄下!!server

 

git服務器搭建 

參考git一鍵安裝包

 

 

 

後續——————————

相關文章
相關標籤/搜索