今日记录的问题:
在本地写了一个项目,想要能够每天同步到码云上面去,进行代码管理。而此时的自己还没有学过git。所以下面是自己翻看查找各种资料,最终成功将项目同步到码云进行管理的过程。小白操作,辣眼睛!!
第一步,按照下面这个链接里的方法,在码云上新建一个项目:
https://jingyan.baidu.com/article/c1465413e4fc8b0bfdfc4c6f.html
注:上面里面将步骤进行到第五步就可以了。
第二步:还没有git吗?按照下面的教程进行下载安装:
https://www.cnblogs.com/smuxiaolei/p/7484678.html
注:里面有一点没有讲清楚,就是安装好了之后,打开Git Bash,然后命令行输入以下命令:(如果没有输入的话,后面你在commit的时候就会一直提醒你要去先把这俩给输入了才能操作)
$ git config --global user.name "Your Name"
$ git config --global user.email "email@example.com"
第三步:建好了项目,还需要有一个对公钥和私钥的操作,按照下面的方法进行生成:
https://jingyan.baidu.com/article/cdddd41cb7466853cb00e1d5.html
注:这篇文章里看到第四步就可以啦!不过里面还少了一点,那就是复制了id_rsa.pub文件里面的内容后,粘贴到了码云的“把公钥粘贴到这里” 的这个地方时,还要自己任意取一个公钥的名称哦:
此时,我们的公钥啥的都搞好了。那么接下来该去把我们的项目弄进去了。
第四步:回到这个网站,继续文章里第六步的操作:
https://jingyan.baidu.com/article/c1465413e4fc8b0bfdfc4c6f.html
至此,成功的学了点git的皮毛,还完成了任务。
在之后将本地更改推送上去时,一般按照下面几个命令进行:
a@DESKTOP-H3RDB7G MINGW64 ~
$ cd d:/mycode/reactANTD
a@DESKTOP-H3RDB7G MINGW64 /d/mycode/reactANTD (master)
$ git add.
git: 'add.' is not a git command. See 'git --help'.
The most similar command is
add
a@DESKTOP-H3RDB7G MINGW64 /d/mycode/reactANTD (master)
$ cd react-antd-demo
a@DESKTOP-H3RDB7G MINGW64 /d/mycode/reactANTD/react-antd-demo (master)
$ git add.
git: 'add.' is not a git command. See 'git --help'.
The most similar command is
add
a@DESKTOP-H3RDB7G MINGW64 /d/mycode/reactANTD/react-antd-demo (master)
$ git add
Nothing specified, nothing added.
Maybe you wanted to say 'git add .'?
a@DESKTOP-H3RDB7G MINGW64 /d/mycode/reactANTD/react-antd-demo (master)
$ git add .
warning: LF will be replaced by CRLF in react-antd-demo/src/pages/.umi/DvaContainer.js.
The file will have its original line endings in your working directory.
warning: LF will be replaced by CRLF in react-antd-demo/src/pages/.umi/router.js.
The file will have its original line endings in your working directory.
warning: LF will be replaced by CRLF in react-antd-demo/src/pages/.umi/umi.js.
The file will have its original line endings in your working directory.
a@DESKTOP-H3RDB7G MINGW64 /d/mycode/reactANTD/react-antd-demo (master)
$ git commit -m '测试一下'
[master 479cdca] 测试一下
1 file changed, 0 insertions(+), 0 deletions(-)
create mode 100644 react-antd-demo/mock/quanxian.js
a@DESKTOP-H3RDB7G MINGW64 /d/mycode/reactANTD/react-antd-demo (master)
$ git push
Enumerating objects: 7, done.
Counting objects: 100% (7/7), done.
Delta compression using up to 4 threads.
Compressing objects: 100% (4/4), done.
Writing objects: 100% (4/4), 396 bytes | 132.00 KiB/s, done.
Total 4 (delta 3), reused 0 (delta 0)
remote: Powered by Gitee.com
To https://gitee.com/taylorzun/reactANTD
d8bcf80..479cdca master -> master
a@DESKTOP-H3RDB7G MINGW64 /d/mycode/reactANTD/react-antd-demo (master)
$
几个易错的小细节注意一下。
cd d:/mycode/react
git add .
git commit -m '更改的地方注释'
git push
查找高质量的、完整的资料花费了我一点时间,非常感谢这些作者总结的经验!奉上我的膝盖~~~~
最后,奉上大神的对git总结链接:
https://www.liaoxuefeng.com/wiki/0013739516305929606dd18361248578c67b8067c8c017b000