Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Git uses the method of specifying ssh-key

2025-01-23 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/02 Report--

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!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report