git to GitHub

  • git init

  • git add .(Here is. Need to be entered together)

    • git add .And git add *differences:
      git add .will all untrack local files are added to the staging area, and will be filtered according to .gitignore, but git add *ignores any file .gitignore to join.
  • git commit -m "my commit"("My commit" is the description of this submission)

  • git remote add origin [email protected]:xxx.git([email protected]:xxx.git` is the path generated for the new warehouse on github)

  • git push -u origin master(The github account password will pop up here)
    Since the newly created remote warehouse is empty, the -u parameter must be added. After the remote warehouse has content, the next time you upload content from the local library, you only need to that's it:
    git push origin master

    • If prompted, the ! [rejected] master -> master (fetch first)
      reason is: github allows you to have things in the local warehouse, but not in the remote warehouse, but does not allow things in the remote warehouse, which is not available in your local warehouse. If the problem is found, the solution is very simple, that is, synchronize the files of the local warehouse and the remote warehouse before pushing. Use the following command:
      git pull --rebase origin master

over

Guess you like

Origin blog.csdn.net/qq_40570466/article/details/108776173