Home  >  Article  >  Development Tools  >  Detailed explanation of how to submit local code to gitee

Detailed explanation of how to submit local code to gitee

PHPz
PHPzOriginal
2023-03-27 10:53:262220browse

Gitee is a well-known open source code hosting platform in China, similar to GitHub. Submitting code on Gitee is very simple. The following will introduce in detail how to submit code to Gitee.

Step 1: Create a warehouse

Before submitting code on Gitee, you need to create a warehouse first. On the Gitee homepage, click the " " sign in the upper right corner, select "New Warehouse", enter the warehouse name and warehouse description, and select the public or private permissions of the warehouse.

Step 2: Create an SSH key

Before using Gitee, you need to create an SSH key. Open Git Bash or other command line terminal and enter the following command:

ssh-keygen -t rsa -C "your_email@example.com"

Follow the prompts and press Enter to generate an SSH key.

Step 3: Add the public key to Gitee

Open the folder where the SSH key was generated, find the id_rsa.pub file, open and copy the contents.

In Gitee's account settings, click the "SSH Public Key" tab, then click "Add Public Key" and enter the name and content of the public key.

Step 4: Add the remote warehouse to the local warehouse

Open the command line terminal and run the following command in the root directory of the local warehouse:

git remote add origin git@gitee.com:username/repo-name.git

Among them, username is your Gitee username, and repo-name is the name of the warehouse you created.

Step 5: Submit the code to Gitee

After making modifications in the local warehouse, use the following command to submit the code to Gitee:

git add .
git commit -m "提交说明"
git push origin master

These The command is explained as follows:

  • git add .: Add all modified files in the current working directory to the staging area.
  • git commit -m "Submit Instructions": Submit all modifications in the staging area to the local warehouse, along with submission instructions.
  • git push origin master: Push changes in the local warehouse to Gitee's remote warehouse.

Summary

The above are the detailed steps on how to submit code to Gitee. Before submitting the code, you need to create a warehouse and SSH key, and connect the local warehouse to the remote warehouse. If you want your project to get better attention, you can actively participate in the open source community on Gitee, contribute your own code, and jointly promote the development of open source.

The above is the detailed content of Detailed explanation of how to submit local code to gitee. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn