git与github常用命令交互
大纲
一、如何推送代码到github中
二、克隆github上的代码
如何推送代码到github中
-
与githun创建的仓库建立连接
git remote add origin “github的仓库地址”
git remote add origin git@github.com:TanxupengSpace/dao.git -
与github建立好连接之后,需要将本地的代码推送到githun仓中
git push -u origin master -
已经将代码推送到github中之后,如何更新
git commit -a -m “Add file to github” 命令将本地的代码提交到本地的版本库中
git push -u origin master 命令在本机的版本库中最新的代码推送到github中
-
克隆github上的代码
-
要想将github中的代码克隆到本地,首先要知道远程仓库的地址,如以下的地址信息。
https://github.com/TanxupengSpace/dao.git
git@github.com:TanxupengSpace/dao.git -
使用git clone https://github.com/TanxupengSpace/dao.git 导出代码
-
在导出之前要先保证已经将远程仓库地址的信息添加进来,使用 git remote add origin “远程仓库地址”
-
如果在导出代码的过程中,发现所导出的使用的仓库地址错误,使用git remote rm origin 删除之后,在加入正确的仓库地址即可。
-
知乎文章: https://www.zhihu.com/people/tan-xu-peng-44
编程专业知识:https://www.cnblogs.com/tjava
编程开发技术问题解决CSDN:https://blog.csdn.net/qq_37291829
浙公网安备 33010602011771号