本文演示两个人如何通过GitHub进行协同开发,founder创建一个项目,然后contributor通过fork贡献代码。
1.安装git并进行配置
sudo apt-get git
git config --global user.name "username"
git config --global user.email "email"
2.founder创建一个项目并上传基础代码
git init
git add .
git commit -m "first commit"
git remote add origin https://github.com/founder/test.git
git push -u origin master
3.contributor fork项目到自己的项目中
3.1 将该项目代码下载到本地
git clone https://github.com/contributor/test.git
3.2 新建并切换到工作分支
git branch dev
git checkout dev
3.3 把founder的项目添加到contributor的远程仓库