Submit code to gitee under linux

1. Introduction to git

Git is a code hosting tool, and gitee is a domestic code hosting platform. This article briefly introduces the basic use of file hosting.

2. How to use

2.1 Create a warehouse

First create your own repository on gitee. Readers are asked to search on their own for the method.

2.2 Clone the repository locally

  • git clone warehouse link (find the link as shown below)

Insert image description here

2.3 Add local warehouse

In the current directory of clone, execute the following command.

  • git add filename/Add the file to the local library
  • git add ./Add all files to the local library

2.4 Submit code

Execute this command after running the add command.

  • git commit -m “messages”
    Be sure to write a commit log record! !

Note:
If the message shown in the figure below appears, just run the following two lines of code, and then commit. Because git needs to record who submitted the code so that it can be easily traced later.
Insert image description here

2.5 Synchronize code to warehouse

After submitting the code, the code is not submitted to the gitee repository and needs to be pushed again.

  • git push
    Synchronize code to warehouse

Note:
The synchronization code requires the account number and password of your gitee account. Just enter it as prompted.

2.6 Other issues

Sometimes there will be problems such as failure to submit and submission conflicts. Specifically, others push, causing the warehouse content to be modified. At this time, your local library is inconsistent with the warehouse information. At this time, you need to copy the warehouse contents to the local library again.
Execution:

  • git pull
    Pull the contents of the warehouse to the local library first, and then push it to solve the problem.

.gitignore file, after you clone the warehouse, there will be a file in the warehouse directory. The function of this file is to automatically ignore some files when adding files to prevent the warehouse from being too cluttered. You can also set the suffix of files you do not want to upload. As shown in the figure, files with the following suffixes will be filtered out by themselves. You can also set it yourself.
Insert image description here

Guess you like

Origin blog.csdn.net/weixin_45153969/article/details/132575184