git 用于 在liunx 系统中控制代码,不过现在官网被墙。工具获取方式在此不做介绍
1. 配置server:
mkdir %yourproject%cd %yourproject%
git --bare init # 建立一个空的 git仓库,
--bare
2. 将PC-1上现有的workspace进行git管理并上传到服务器端:
cd workspace
git init
git add *
git commit -m 'initial commit'
git remote add origin ssh://huzhenwei@192.168.1.2/home/huzhenwei/repos.git #192.168.1.2为服务器的VPN内网IP
git push origin master #将本地的代码上传到服务器端
3. 从服务器端检出版本库到PC-2,在PC-2上新建文件并上传到服务器端:
git clone ssh://huzhenwei@192.168.1.2/home/huzhenwei/repos.git workspacecd workspace
touch newfile #创建一个新文件来做测试
git add newfile
git commit -m 'add newfile'
git push origin master #将本地的代码上传到服务器端