Home >Development Tools >git >How to use gitee repository? (user's guidance)

How to use gitee repository? (user's guidance)

PHPz
PHPzOriginal
2023-03-31 09:08:381802browse

Gitee is a domestic open source code hosting platform, similar to Github, a similar global website, but it places more emphasis on the needs of domestic users. Using Gitee in China can speed up code transmission and improve code access speed. Below is a brief guide to help you get started with Gitee.

1. Create a Gitee account

First, you need to register an account on the Gitee website (https://gitee.com/). Click the "Register" button in the upper right corner of the page, fill in the necessary information and set a password. Upon completion, you will receive a Gitee account and access to various repositories and projects on Gitee.

2. Create a new repository

To host code on Gitee, you need to create a repository named "Repository". After logging in, click the "New Warehouse" button in the menu bar at the top of the page. In the pop-up window, you need to fill in the relevant information of the warehouse, for example:

  • Warehouse name: The name of the warehouse you want to create, you can use any name you like.
  • Warehouse type: You can choose Git or SVN.
  • Warehouse Description: Give a brief description of your warehouse.
  • Repository permissions: You can choose a public or private repository. If you want everyone to have access to the code, choose a public repository. If you only want to share code with team members, choose a private repository (this requires a fee).

After completion, click the "Create Warehouse" button to complete the creation of the new warehouse.

3. Upload code

After you have created a warehouse, you need to upload the code to the warehouse in Gitee.

  • First, use the git tool to connect the local code base to the warehouse created on Gitee.

You can use the command line to move to the directory where your local code repository is located using the following command in your local terminal:

cd <your_local_repository>

On your Gitee repository page, find SSH Clone URL or HTTPS Clone URL and copy this URL to your clipboard.

Next, use the following command in your local terminal to get started by pushing your repository to Gitee:

SSH

git remote add origin git@gitee.com:<your_gitee_username>/<your_gitee_repository>.git
git push -u origin master

HTTPS

git remote add origin https://gitee.com/<your_gitee_username>/<your_gitee_repository>.git
git push -u origin master

You will be asked to enter the username and password you use on Gitee.

  • If you don't want to use the command line, you can use some other GUI tools, such as Sourcetree or GitKraken.

4. Set up Collaborator

If you have a project or repository, you may want to give others some permissions to access or manage it. To add a person as an administrator or collaborator of a Gitee repository, do the following.

  • Log in to Gitee and open the warehouse page.
  • In the right sidebar, click "Project Settings".
  • Click "Collaborator".
  • Search for the username or email address of the collaborator you want to add.
  • Select their role as administrator or all.

5. Clone the remote repository

If you want to clone the code in the Gitee repository locally for editing or use, you can use the following command to clone its repository.

git clone https://gitee.com/<your_gitee_username>/<your_gitee_repository>.git

This will create a new folder called "" and copy the code from the Gitee repository into it.

6. Conclusion

Gitee is an overly powerful code hosting platform. If you are looking for a better alternative than Github, then it is a good choice. Below is a simple getting started guide for you to start using Gitee. As you get deeper into it, you'll find it more fun and satisfying.

The above is the detailed content of How to use gitee repository? (user's guidance). 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