Upload Git local code to GitHub remote warehouse

Initialize the local warehouse

Enter the project address and initialize the project into a git local warehouse through the command git init

Execution: The git initcommand initializes the local code repository,
displays the hidden folder. Git succeeds
Insert picture description here

Add all files in the project to the staging area

Execute: git add .add all files in the project to the temporary storage area,
Insert picture description here
there will be no output, wait for the next input, which is successful

Submit the modified content stored in the temporary storage area to the local warehouse

git commitCommand will be git add .stored in the temporary storage area to modify the content presented to the local repository, if the file is not added to the staging area, not to commit any changes when it is submitted.
git commit -m 'xxx'// xxx is the name of Notes Notes must be written

Create a new warehouse on github, copy the warehouse address, and then use the command to establish a connection between the local warehouse and the remote warehouse

  • git remote add origin xxx//xxx is the address of the git warehouse

    • Use HTTPS address for submission this time
  • ② An error may appear in this step, indicating fatal: remote origin already exists
    Insert picture description here

  • ③ Execution: git remote rm originCommand

  • Then execute the order of ①

Push the code in the staging area to the remote warehouse

git push -u origin master
Insert picture description here
At this point, the Git local code is uploaded to the remote warehouse to complete

Guess you like

Origin blog.csdn.net/qq_43562262/article/details/108766789