[Transfer] Use Git to submit local files to remote warehouse

Use Git to submit local files to remote warehouses

Now to push the local code to the git remote warehouse for storage, you can submit and pull operations

  • The local project has been created
  • The git remote warehouse has been built (github, gitee both work)

The operation is as follows:

1. (First enter the project folder) Use the command git init to turn this directory into a warehouse that git can manage

git init

2. Add files to the version library, use the command git add . to add to the temporary storage area, don’t forget the decimal point ".", which means adding all files under the folder

git add .


3. Use the command git commit to tell Git to submit the file to the warehouse. Commit instructions in quotes: git commit -m 'initialize the project'

git commit -m 'initialize the project'


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

git remote add origin https://github.com/zhangsan/project.git


5. git pull to obtain the remote library and local synchronous merge (this step must be done if the remote library is not empty, otherwise the subsequent submission will fail)

git pull --rebase origin master

6. To push the content of the local library to the remote, use the git push command to actually push the current branch master to the remote. After executing this command, you will be asked to enter the user name and password, and the upload will start after the verification is passed.

git push -u origin master

————————————————
Copyright statement: This article is the original article of CSDN blogger "Lactate Jun" and follows the CC 4.0 BY-SA copyright agreement. For reprinting, please attach the original source link and this statement.
Original link: https://blog.csdn.net/hanlt/article/details/126668856

おすすめ

転載: blog.csdn.net/mao_mao37/article/details/130801728