Use Git commands to push local files to remote repositories

Use the git command to push local files to the remote warehouse.
The specific operations are as follows

1. Enter the project folder and turn this directory into a manageable warehouse by commanding git init

git init

2. Add the file to the repository and use the command git add . to add it to the temporary storage area. Don’t forget the decimal point “.” at the end, which means to add all the files in the folder.

git add .

3. Use the command git commit "commit instructions" to tell Git to submit the file to the warehouse. Submission instructions are enclosed in quotation marks

git commit -m "submit code"

4. Associate to the remote library git remote add origin your remote library address 

 git remote add origin https://:..

5. git pull obtains the remote library and merges it with the local synchronization (this step must be done if the remote library is not empty, otherwise subsequent submissions will fail) 

git pull --rebase origin master (synchronize merged branches)

6. Push the contents of the local library to the remote, use the git push command, which actually pushes the current branch master to the remote. After executing this command, you will be asked to enter your username and password. Once the verification is passed, the upload will begin. 

git push -u origin master (push to remote branch)
 

Guess you like

Origin blog.csdn.net/davice_li/article/details/131798613