1、安装nodo
2、安装npm
3、安装git
4、注册码云账号,在码云个人主页新建一个私有仓库

5.在设置页面配置公钥匙:

配置成功,输入cat ~/.ssh/id_rsa.pub,就会显示你配置的公钥。然后在码云上设置你的公钥。
6、把远端仓库里的代码克隆到本地,使之关联起来


7、然后在gitDemo文件夹里创建一个test文件夹,里面放一个文件:

8.然后执行下面的提交命令,就完成了代码的提交
一、提交相关
1、git add .
把本地的修改提交到git的本地缓冲区
2、git commit -m '提交描述'
将本地缓冲区的代码提交到本地仓库。
3、git push
将本地的代码提交到远程仓库

9、新建分支开发:
在码云上新建分支test01

执行一下命令,切换到test01分支

当然你也可以通过命令行创建分支并切换到所在分支:

git branch 查看当前所在的分支
git checkout -b test02 创建test02分支,并切换到test02所在的分支
10、在test01分支上复制一个文件

然后执行git add . git commit git push三部曲,提交到远端仓库

11、合并分支到主干
先切换到master分支,运行如下命令:

这样分支的代码就合并到主干了。
最后开发在分支上,以后开发完再合并到主干。对于一个人开发一个项目这样是可以的满足要求的,对于多人开发团队,往往还要分develop分支和release分支,还有tag标志,这些在后续我也会去写文章
总结:当然码云服务器只是一种形式,真正公司开发时候,会有自己公司的git服务器,步骤基本一样。
网友评论