git连接华为云DevCloud
华为云DevCloud在代码托管方面的个github很类似,引入了代码仓库的概念,同时需要本地安装git客户端,且只能与git进行连接,从这个角度上讲,DevCloud的代码管理部分就是github的功能,下面对git对接DevCloud做说明,
首先,需要在本地git与DevCloud之间建立安全壳连接(ssh)
华为的官网上有指导,但是是基于Linux下的,我写出Windows下的连接方法。
安装完git后,来一个git config,看看自己的信息。
然后在git的运行目录下建立一个.ssh文件夹。我的电脑中git是运行在c:/users/用户名这个目录下,我一看没有.ssh文件夹,则新建一个,git bush中用mkdir ~/.ssh,如图

然后,在git bush中生成ssh秘钥
ssh-keygen -t rsa -C “[email protected]” 注意,这个双引号中间的是自己的邮箱,
回车完之后,bush 会提示你,是不是在这个文件夹下建立ssh,你直接回车
完事她又问,是否用密码,不理他,直接回车,完事她又让你重复一面密码,你依然回车,设置空密码。
三次回车,生成秘钥完成,你会发现在git运行目录下\.ssh目录下,生成了两个文件。如图:

没错,id_rsa.pub中保存的就是ssh秘钥,你可以记事本直接打开。粘贴到DevCloud中的秘钥栏就可以了,这样本地git就与DevCloud服务建立了ssh连接。
第二步:本地git连接DevCloud
打开git gui,不用bush.,这样比较简单,

在远程/添加中打开对话框,在远程细节这一栏,有两个要填,一个名字,一个地址,对应右图华为云的名称和地址,直接复制过去,然后添加。


添加成功会显示如下对话空

第三步:我们把本地代码“推”到DevCloud

选好华为云的名字,勾选上强制重写已存在的分支
