search
HomeDevelopment ToolsgitLearn Git to configure SSH (common to github, gitee, and gitlab)

Learn Git to configure SSH (common to github, gitee, and gitlab)

Preface

Git warehouses generally have two reading and writing methods: https and ssh. https is very simple and can be accessed directly through account and password, while ssh uses It is more cumbersome, and you need to configure the public key and private key first, because ssh uses RSA-based encryption for verification.

Recommendation (free): Git

SSH configuration

github and gitee both provide Git based on the SSH protocol Service, before using the SSH protocol to access the warehouse, you need to configure the SSH public key of the account/warehouse.

1. Generate key

You can generate ssh key by following the command:

ssh-Learn Git to configure SSH (common to github, gitee, and gitlab) -t rsa -C "xxxxx@xxxxx.com"  
# Generating public/private rsa key pair...

Follow the prompts and press Enter three times to generate ssh key. Obtain your public key by viewing the contents of the ~/.ssh/id_rsa.pub file

cat ~/.ssh/id_rsa.pub
# ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC6eNtGpNGwstc....

Learn Git to configure SSH (common to github, gitee, and gitlab)

2. Deploy the public key

Copy the generated ssh key, add the generated public key to the warehouse through the warehouse homepage"Management"->"Deployment Public Key Management"->"Add Deployment Public Key".
Learn Git to configure SSH (common to github, gitee, and gitlab)

3. Add ssh trust locally

After adding, enter

ssh -T git@gitee.com

in the Terminal. For first time use, you need to confirm and add the host to this Machine SSH trusted list. If the content Hi XXX! You’ve successfully authenticated, but Gitee.com does not provide shell access. is returned, the addition is successful.

SSH Add Tips
Learn Git to configure SSH (common to github, gitee, and gitlab)
After the addition is successful, you can use the SSH protocol to operate the warehouse.

4. Warehouse public key and deployable public key

In order to facilitate users to use a set of public keys under multiple project warehouses and avoid the tediousness of repeated deployment and management, Code Cloud has launched The "Deployable Public Key" function supports the use of the deployed public key of another warehouse space under the current account name/participation in one warehouse space to achieve public key sharing.


SourceTree settings

Users who use git generally use SourceTree more. After configuring ssh, they need to be imported into sourceTree before they can be used.

1. Create or import ssh key

Click[Tools] -> [Create or import SSH key]
Learn Git to configure SSH (common to github, gitee, and gitlab)## Open the PuTTY tool generator
Use Generate to directly generate the public key and private key
If you already have the key, you can click Load to load it and select the id_rsa file.

Learn Git to configure SSH (common to github, gitee, and gitlab)

2. Generate ppk file

After loading, do not close, continue to click **[Save Private key]

. Save[ppk file]**, (It is best to put these files together, under the user/.ssh file)
Learn Git to configure SSH (common to github, gitee, and gitlab) After saving, you can close the window

3. Import the PPK file

and then open **[Enable SSH Assistant]**


Learn Git to configure SSH (common to github, gitee, and gitlab) After opening, it may be hidden in the task panel below, just find it and open it

Learn Git to configure SSH (common to github, gitee, and gitlab) Click the **[Add Key]
button and select the ppk file just generated**
Learn Git to configure SSH (common to github, gitee, and gitlab) The configuration is complete and you can close it
Next, sourceTree can read and write remote warehouses through ssh.

Hope this article can be helpful to you.

The above is the detailed content of Learn Git to configure SSH (common to github, gitee, and gitlab). For more information, please follow other related articles on the PHP Chinese website!

Statement
This article is reproduced at:CSDN. If there is any infringement, please contact admin@php.cn delete
GitHub: A Hub for Open Source and Software DevelopmentGitHub: A Hub for Open Source and Software DevelopmentApr 15, 2025 am 12:10 AM

GitHub is a Git-based version control system hosting platform that provides version control, collaborative development and community communication functions. Using GitHub can improve development efficiency and code quality.

Git and GitHub: What's the Relationship?Git and GitHub: What's the Relationship?Apr 14, 2025 am 12:10 AM

Git and GitHub are different tools: Git is software for version control, and GitHub is an online platform based on Git. 1.Git allows you to track file changes and collaborative development. 2. GitHub provides code hosting and collaboration tools to enhance team development efficiency.

GitHub: The Platform for Developers and ProjectsGitHub: The Platform for Developers and ProjectsApr 13, 2025 am 12:01 AM

The core features of GitHub include version control, branch management, code review, issue tracking and project management. 1. Version control and branch management are based on Git, allowing tracking of code changes and experimental development. 2. Code review is implemented through PullRequest to improve code quality and team collaboration. 3. Issues tracking and project management are carried out through Issues and the project management board to improve project transparency and traceability.

GitHub in Action: Examples and Use CasesGitHub in Action: Examples and Use CasesApr 12, 2025 am 12:16 AM

GitHub is a powerful tool to improve the efficiency and quality of software development. 1) Version control: manage code changes through Git. 2) PullRequests: Conduct code review and improve code quality. 3) Issues: Track bugs and project progress. 4) GitHubActions: Automate the construction, testing and deployment process.

Git vs. GitHub: Version Control and Code HostingGit vs. GitHub: Version Control and Code HostingApr 11, 2025 am 11:33 AM

Git is a version control system, and GitHub is a Git-based code hosting platform. Git is used to manage code versions and supports local operations; GitHub provides online collaboration tools such as Issue tracking and PullRequest.

What is Git in simple words?What is Git in simple words?Apr 09, 2025 am 12:12 AM

Git is an open source distributed version control system that helps developers track file changes, work together and manage code versions. Its core functions include: 1) record code modifications, 2) fallback to previous versions, 3) collaborative development, and 4) create and manage branches for parallel development.

Is Git the same as GitHub?Is Git the same as GitHub?Apr 08, 2025 am 12:13 AM

Git and GitHub are not the same thing. Git is a version control system, and GitHub is a Git-based code hosting platform. Git is used to manage code versions, and GitHub provides an online collaboration environment.

How to use GitHub for HTML?How to use GitHub for HTML?Apr 07, 2025 am 12:13 AM

The reason for using GitHub to manage HTML projects is that it provides a platform for version control, collaborative development and presentation of works. The specific steps include: 1. Create and initialize the Git repository, 2. Add and submit HTML files, 3. Push to GitHub, 4. Use GitHubPages to deploy web pages, 5. Use GitHubActions to automate building and deployment. In addition, GitHub also supports code review, Issue and PullRequest features to help optimize and collaborate on HTML projects.

See all articles

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
4 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. Best Graphic Settings
4 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. How to Fix Audio if You Can't Hear Anyone
4 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
WWE 2K25: How To Unlock Everything In MyRise
1 months agoBy尊渡假赌尊渡假赌尊渡假赌

Hot Tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

PhpStorm Mac version

PhpStorm Mac version

The latest (2018.2.1) professional PHP integrated development tool

WebStorm Mac version

WebStorm Mac version

Useful JavaScript development tools

Atom editor mac version download

Atom editor mac version download

The most popular open source editor

Dreamweaver Mac version

Dreamweaver Mac version

Visual web development tools