内部开发环境 git代码托管说明

时间:2023-03-08 16:54:45

前言

随着员工的增加 代码的开发版本管理 提上了日程。初步计划:

1 一台机器 192.168.1.240 git代码版本管理

2 运行环境 192.168.1.241 内部开发运行环境

软件工程师 通过git 每天吧代码从本地push到 git服务器,git服务器 实时的最新的动态同步到运行环境服务器。

软件工程师 通过192.168.1.241进行测试代码

搭建同步rsync

一键搭建安装rsync包代码

#!/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() and rsyncd.conf() man pages for help # This line is required by the /etc/init.d/rsyncd script
pid file = /var/run/rsyncd.pid
port =
#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 =
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 ,+ per user, per sync
#transfer logging = yes log format = %t %a %m %f %b
syslog facility = local3
timeout = [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 /etc/rsyncd/rsyncd.secrets
cat >/etc/rsyncd/rsyncd.motd<<EOF
+++++++++++++++++++++++++++
+ centos.bz rsync - +
+++++++++++++++++++++++++++
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

客户端同样如此

客户端配置密码文件 不需要用户名 只要密码 切记

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

同步测试

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

客户端 运行以上代码同步home模块的配置 到本地 ranmufei/test/ 目录下!!

git服务器搭建

参考git一键安装包

后续——————————