(20210221已解决)如何将本地已有文件夹push到github并新建仓库

  • Overview

    In english, maybe this question:

    How to push local directory to github, and create a new repository?

  • Solutions

    1. Github: Create a new repository on Github, get the https URL

      创建时保证是空的,不要添加Readme或.gitignore, 避免出现 master had recent pushes Compare & pull request

    2. Local:

      cd project
      git init
      git add *
      git commit -m "Initial"
      git remote add origin https_URL
      git remote -v
      git push -f origin master
      
  • References

  1. Adding an existing project to GitHub using the command line

猜你喜欢

转载自blog.csdn.net/The_Time_Runner/article/details/113925002