-
创建新的 git 仓库
git init
-
如果是远端服务器上的仓库,你的命令会是这个样子:
git clone username@host:/path/to/repository
3.添加与提交
git add <filename> # 提交一个文件
git add * #提交所有文件
git commit -m "代码提交信息" #实际提交成功
现在,你的改动已经提交到了 HEAD,但是还没到你的远端仓库。
-
提交到远程仓库
git push origin master
可以把 master 换成你想要推送的任何分支。
如何有冲突
git reset --hard
fatal: 远程 origin 已经存在。
此时只需要将远程配置删除,重新添加即可;
git remote rm origin