Git 作为当前比较流行的代码管理工具,可以实现多人协作,不同版本代码管理。
本文内容基于Ubuntu.
0. 配置git信息
1 git config --global user.name XXX # XXX 为github 账户信息,如果仅仅创建本地账户的话也可以自行填写信息 2 git config --global user.email XXX
1. 创建局域网仓库库服务器
1 mkdir workspace 2 cd workspace 3 git init workspace.git --bare
2. 创建本地版本
1 gti clone user@localIP:/path/workspace.git
3. 管理本地代码
1 git add file/folder #添加文件或文件夹 2 git commit -m "****" #添加注释 3 git remote add origin user@localIP:/path/workspace.git
4 git push origin master #上传
4. 其他git 常用命令
git status # 查看文件状态
git pull #更新本地