Home >Development Tools >git >How to configure local account and password on gitee (steps)

How to configure local account and password on gitee (steps)

PHPz
PHPzOriginal
2023-04-10 09:48:344136browse

Before using Gitee for code hosting and team collaboration, you need to configure a local account and password. The following are the specific steps:

  1. Register and log in to the Gitee official website;
  2. Find the "Access Token" tab in the account settings, create a new Access Token, and save the Token value locally, which will be used later;
  3. Download and install the Git client, after the installation is complete Enter the following command line in the command line window:
git config --global user.name "你的Gitee用户名"
git config --global user.email "你的Gitee注册邮箱"
git config --global credential.helper store

The third line of command is to save the local username and password to avoid having to enter them every time. If you do not add this command, you will need to enter your account and password during each push and pull operation.

  1. Next, you need to set up SSH communication between local Git and Gitee, and add Access Token to the SSH key. The specific steps are as follows:
ssh-keygen -t rsa -C "你的Gitee邮箱"

At this time, It is required to enter the SSH key storage path. You can directly press "Enter" to use the default path. You will then be asked to enter a password, you can also press the "Enter" key to skip it.

cat ~/.ssh/id_rsa.pub | pbcopy

The above command is to copy the contents of the id_rsa.pub file to the pasteboard and wait for the next step to paste.

  1. Go back to the Gitee official website, find the SSH Keys tab in the account settings, create new SSH Keys, and add the Access Token copied in the pasteboard to the Key value;
  2. Finally, use the following command to test:
ssh git@gitee.com

If "Hi XXX! You've successfully authenticated, but Gitee.com does not provide shell access." appears, the configuration is complete. Now you You can freely use Gitee to host your own code.

It should be noted that the above steps are for push and pull operations from the local code base to Gitee. If you need to clone the local code base from Gitee, you need to configure the "SSH public key" in Gitee. .

The above is the detailed content of How to configure local account and password on gitee (steps). 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