Home > Development Tools > git > How to upload local code to gitee for version management

How to upload local code to gitee for version management

PHPz
Release: 2023-04-10 15:08:56
Original
992 people have browsed it

With the continuous development of cloud computing technology, Git has become one of the standards for open source project management and version control, and gitee is a relatively popular Git code hosting platform in China. When many developers are working on some of their own projects, they upload local code to gitee for version management. Below we will introduce in detail how to upload local code to gitee.

1. Create a project on gitee

First, we need to create a project on gitee. Log in to your gitee account, click the " " button in the upper right corner, and select "New Warehouse" in the pop-up drop-down menu.

Then fill in the basic information of the warehouse, including the organization it belongs to, the name of the warehouse, the introduction of the warehouse, the publicity level of the selected warehouse, etc.

Finally, click the "Create Warehouse" button.

2. Configure Git locally

Before we upload local code to gitee, we need to configure Git locally. If you haven't installed Git yet, please install Git first.

After the installation is complete, enter the following command on the command line for global configuration:

$ git config --global user.name "Your Name"
$ git config --global user.email "email@example.com"
Copy after login

Among them, "Your Name" is your user name, and "email@example.com" is your email address.

3. Create a project locally

Next, we need to create a project locally and write some code.

Find a suitable directory locally, then enter the directory on the command line and execute the following command:

$ mkdir my-project
$ cd my-project
$ git init
Copy after login

This creates a project named "my-project" locally , and initialized the Git repository.

4. Add code to the repository

After creating the project locally, we need to add the code to the Git repository. After we edit the code, execute the following command on the command line:

$ git add .
$ git commit -m "Initial commit"
Copy after login

where "Initial commit" is our submission information, which can be modified according to the actual situation.

5. Associate the gitee repository

After creating the project locally and adding the code to the Git repository, we need to associate the local Git repository with the newly created repository on gitee. Enter the following command on the command line:

$ git remote add origin https://gitee.com/your_username/your_project_name.git
$ git push -u origin master
Copy after login

where "your_username" is your gitee username, and "your_project_name" is the name of the project you created on gitee.

At this point, our local code has been successfully uploaded to gitee.

Through the above five steps, we introduced in detail how to upload local code to gitee. It is worth noting that in order to ensure the security of the code, we need to set up an SSH public key on gitee, so that authentication is required every time the code is submitted. At the same time, before uploading the code, you must also carefully check the integrity and correctness of the code to ensure code quality.

The above is the detailed content of How to upload local code to gitee for version management. For more information, please follow other related articles on the PHP Chinese website!

source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template