github 使用方法总结 还有一部分不太懂

github在新的目录下添加新的文件

git init //在相应的目录下添加

git add //添加目录

git commit -m "first commit"

git config --global user.email "834916321@qq.com"

git config --global user.name "timeless"

git remote add origin https://github.com/timelessz/crm.git

git push -u origin master

遇见错误

1.$ git remote add origin git@github.com:WadeLeng/hello-world.git

错误提示:fatal: remote origin already exists.

解决办法:git remote rm origin

然后在执行:$ git remote add origin git@github.com:WadeLeng/hello-world.git 就不会报错误了

2  已经有的文件更新

先把gihub上的文件更新下来:

git pull origin master

错误提示:error:failed to push som refs to

解决办法:$ git pull origin master //先把远程服务器github上面的文件拉先来,再push 上去。

3   复制文件到当前项目

git clone https://github.com/timelessz/cardmanage.git

4 本地已经存在了代码,而仓库里有更新,把更改的合并到本地的项目

git fetch origin //获取远程更新

git merge origin/master -m “ ” //把更新的内容合并到本地分支

5把服务器上的数据更新下来

 git pull origin master
原文地址:https://www.cnblogs.com/timelesszhuang/p/3947598.html