1. 切换到本地项目地址 git init 初始化项目。该步骤会创建一个 .git文件夹是附属于该仓库的工作树。

  2. git add .

  3. git commit -am 'initial commit'

  4. git remote add origin git@github.com:dfa/sku.git 或者 git remote add origin https://github.com/ooo/sku.git 把本地项目和github远程仓库发生关联

    可能需要执行git config --global push.default matching命令,使得push命令默认push到github的同名仓库中

  5. push -u origin master 把本地项目push到远程github仓库

  6. 如果第5步失败,出错为github上的版本和本地版本冲突的解决方法:git push -u origin master -f ,就大功告成啦~

本地仓库与远程仓库解除关联 rm -rf .git 删除该仓库的工作树即可 第2、3步可以在第4步之后执行

相关文章:

  • 2021-05-10
  • 2021-10-16
  • 2022-12-23
  • 2021-07-17
  • 2022-02-13
  • 2022-12-23
  • 2021-12-17
猜你喜欢
  • 2022-01-22
  • 2021-06-09
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-02-07
  • 2021-09-17
相关资源
相似解决方案