简体   繁体   English

如何配置 ssh git

[英]How to config ssh git

I've been having a hard time lately setting up and creating a key on ssh, how do I get rid of the problem I'm having我最近在 ssh 上设置和创建密钥时遇到了困难,我该如何解决我遇到的问题

git conifg ssh

In order to create an SSH Key Pair, you need to run the command $ ssh-keygen -t rsa -b 2048 -C my-key-name .为了创建一个 SSH 密钥对,您需要运行命令$ ssh-keygen -t rsa -b 2048 -C my-key-name

This command will generate two files.此命令将生成两个文件。 The one ending with.pub is the publick key you have to upload to GitHub.以.pub结尾的是你要上传到GitHub的公钥。

$ cat.ssh/id_rsa.pub

Paste the content to the GitHub page under Settings > SSH and GPG keys > Add SSH Key.将内容粘贴到设置 > SSH 和 GPG 密钥 > 添加 SSH 密钥下的 GitHub 页面。

Then, you can test it running $ ssh -T git@github.com .然后,你可以运行$ ssh -T git@github.com来测试它。

If you see a message such as Hi <your user>, You've successfully authenticated. but GitHub does not provide shell access.如果您看到诸如Hi <your user>, You've successfully authenticated. but GitHub does not provide shell access. Hi <your user>, You've successfully authenticated. but GitHub does not provide shell access. , it means you can start using Git with the SSH key. ,这意味着您可以使用 SSH 密钥开始使用 Git。 :) :)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM