webstorm 通过GIT同步项目到码云

每次项目同步到git码云之后,都会好长一段时间不再新上传项目,长时间不使用导致每次项目在新上传时都会记不住使用步骤。在此记下,以作笔记。

在此以react native 项目为例。

首先在命令行进入项目的目录 执行 react-native init Test 生成项目Test

webstorm 通过GIT同步项目到码云

webstorm打开项目

webstorm 通过GIT同步项目到码云

登陆到码云 新建项目Test

webstorm 通过GIT同步项目到码云

webstorm 通过GIT同步项目到码云

在webstorm的TEST项目中添加版本管理

webstorm 通过GIT同步项目到码云

选中需要上传的项目

webstorm 通过GIT同步项目到码云

ADD操作

在webstorm中右击项目 选中 git —> add

webstorm 通过GIT同步项目到码云

添加成功之后,项目中的字体颜色变成绿色

webstorm 通过GIT同步项目到码云

commit 操作

右击项目 git —> commit directory 提交添加的文件

webstorm 通过GIT同步项目到码云

webstorm 通过GIT同步项目到码云

填写commit message 然后点击commit 提交

webstorm 通过GIT同步项目到码云

pull操作

提交之后 右击项目 选中 git —> repository —> push 将项目push上去

webstorm 通过GIT同步项目到码云

webstorm 通过GIT同步项目到码云

登陆码云 选择新建的Test项目 克隆/下载 选项 复制git地址

webstorm 通过GIT同步项目到码云

点击上图的 define remote 在弹框中填入复制的连接

webstorm 通过GIT同步项目到码云

点击ok

webstorm 通过GIT同步项目到码云

push提交代码。

按照正常的情况一般都是push失败的

webstorm 通过GIT同步项目到码云

不用问为什么,我也不知道,反正先不管它了,失败就失败吧!后面有办法解决

 

提交之后 右击项目 选中 git —> repository —> pull将服务器上的文件更新到本地

webstorm 通过GIT同步项目到码云

点击pull之后会有一个弹框,按照数字标注的顺序执行

webstorm 通过GIT同步项目到码云

不出意外的话又是失败的

webstorm 通过GIT同步项目到码云

有点绝望吗?不可能,错误信息给出提示了

打开项目Test的所在位置,右击选择 Git Bash Here 打开git命令行窗口

webstorm 通过GIT同步项目到码云

在git命令行窗口中输入命令 git pull origin master --allow-unrelated-histories

webstorm 通过GIT同步项目到码云

待命令执行完毕之后,在webstorm的version contral 中会把刚才 pull 操作的文件更新到本地

webstorm 通过GIT同步项目到码云

此时本地文件以及更新,就可正常操作了。按照顺序依次执行 ADD操作 --- commit操作 ----- pull操作  就可以了

webstorm 通过GIT同步项目到码云

webstorm 通过GIT同步项目到码云

webstorm 通过GIT同步项目到码云

此处直接选择 commit and push

webstorm 通过GIT同步项目到码云

点击push代码提交成功

webstorm 通过GIT同步项目到码云

打开浏览器 刷新Test项目所在的网页 发现代码已经更新

webstorm 通过GIT同步项目到码云