多人管理项目使用git
参考:
https://www.liaoxuefeng.com/wiki/0013739516305929606dd18361248578c67b8067c8c017b000
https://blog.csdn.net/qq_27093465/article/details/76080878?locationNum=9&fps=1
https://blog.csdn.net/qq_26787115/article/details/52133008
前言
git是一个项目管理工具,通过git可以来管理多人修改的代码,下面我就来介绍一下多人怎样使用git。
需要
github账号或一个git服务器(局域网),安装git。
步骤
下载git
官网下载,并安装
配置git
$ git config --global user.name "Your Name"
$ git config --global user.email "[email protected]"
创建仓库(主机)
多人使用git,需要有一个人在GitHub或服务器,创建一个仓库。
怎么在GitHub上创建仓库,这里就不讲了。
创建SSH密钥
SSH是一种验证身份的工具,可以在用户目录下使用git commnd创建
$ ssh-keygen -t rsa -C "[email protected]"
添加collaborator
将伙伴添加同同一个仓库中(项目)中。
clone远端的仓库
$ git clone git@github.com:username/projectname.git
小伙伴可以clone仓库的代码,进行编辑了!
修改和提交
修改代码:
$ git add file1.txt
$ git commit -m "add one files."
提交代码:
$ git push
$ git pull // if nesserary
PS:
也可以通过fork-pull request的方式实现多人管理项目:
先fork源代码修改后pull request给主机。