Get the App
SLTechnology News&Howtos  ›  Internet Technology  › 

Git uses the method of specifying ssh-key

Shulou Source: shulou.com Published: 2022-06-02 08:49:45 10月02日 Update

This article mainly explains "git uses the method of specifying ssh-key". Interested friends may wish to have a look at it. The method introduced in this paper is simple, fast and practical. Now let the editor to take you to learn "git uses the method of specifying ssh-key"!

Working with scen

When everyone in the company shares the same server, when using git pull substitution code, if you use http to pull, either enter the account password each time, or find an account with all the projects and set it as the default account (unrealistic)

In order not to enter the password, then use the git protocol to pull the code. The company has created a ssh-key for security, so you can't replace it directly, you can only regenerate your own ssh-key.

Operation process

To generate your own key, you can enter your password or not (if you do, enter your password every time you pull the replacement code)

Ssh-keygen-t rsa-C "whirlyyin@qq.com"

At this point, we have created a new ssh-key, but we will not use it when using git, so we need to configure 2. 5. You need to put the public key (that is, the .pub file under the key directory, beginning with ssh-rsa) on the git server, and I use github to demonstrate

Just add it here. 3. Use your own ssh-key when setting up git, and create a new config file under the production key directory (append it if it exists)

`Host github.com

HostName github.comUser 952185837@qq.comPreferredAuthentications publickeyIdentityFile / root/.ssh/id_rsa_github

`

Host, hostName: corresponding network, some companies have their own

User: registered mailbox

PreferredAuthentications: this fixed is publickey

IdentityFile: this is the file location of the private key

Linux for security, you need to set the config file to 600. execute the following code in the folder where the key is stored

Chmod 600 config 5. To test it, you can just execute the following code, ssh-T github.com.

At this point, I believe you have a deeper understanding of "git uses the method of specifying ssh-key". You might as well do it in practice. Here is the website, more related content can enter the relevant channels to inquire, follow us, continue to learn!

Tags: Code file method password company account face input security content key server directory or learning service generation practical deeper location Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno macOS Xiaomi Huawei vpn Shulou Tech Info