Home > Article > Development Tools > How to add a project to gitee
In the field of software development, source code management is an indispensable part. Hosting the project on the cloud can ensure that the code is not lost and can easily collaborate with others for development. Gitee is one of the leading open source code hosting platforms in China. It provides developers with a series of services such as free, stable, and efficient code hosting, project management, code contribution review, and collaborative development tools. Below, we will introduce how to add projects to Gitee.
Step 1: Register an account
First, we need to register an account on the Gitee official website. If you already have an account, you can skip this step. The registration process is extremely simple, just fill in the basic information and activate your email.
Step 2: Create a warehouse
After logging in to Gitee, click "New Warehouse" in the upper right corner of the homepage. In the pop-up page, fill in the warehouse information, as shown below:
Among them, "warehouse name" is filled in with the project name, and "warehouse description" is filled with project introduction. In "Warehouse Type", we can choose a public warehouse or a private warehouse. A public repository refers to a repository that shares project code with others, while a private repository is a repository that is only visible to you.
Step 3: Add SSH public key
When uploading the project to Gitee, we need to do it through the SSH protocol, so we need to add the SSH public key on the local computer to the Gitee account . Here we take the Windows operating system as an example to introduce the specific operation steps:
ssh-keygen -t rsa -C "youremail@example.com"
Step 4: Add a remote warehouse
Next, we need to associate the local warehouse with the Gitee remote warehouse. In the local warehouse folder, press the Shift key and right-click, select "Open command prompt window here" (or "Open PowerShell window here"), and enter the following command:
git remote add origin git@gitee.com:用户名/仓库名称.git
where, The user name is the user name we set in our Gitee account, and the warehouse name is the name of the project we created in Gitee.
Step 5: Push the code to the remote repository
The last step is to upload the local code to the Gitee remote repository. In the local warehouse folder, press the Shift key and right-click, select "Open command prompt window here" (or "Open PowerShell window here"), and enter the following command:
git push -u origin master
here The "-u" option refers to associate the local master branch to the master branch of the remote warehouse origin.
If you want to update the local code to the remote warehouse, just execute the "git push origin master" command in the local folder.
Summary
To sum up, adding a project to Gitee is not difficult, just follow the above steps carefully. In practical applications, we need to pay attention to protecting the security of SSH private keys and not leaking them to others; at the same time, when multiple people collaborate on development, we need to pay attention to the management of project branches to avoid code conflicts and confusion. I hope this article can bring you some help.
The above is the detailed content of How to add a project to gitee. For more information, please follow other related articles on the PHP Chinese website!