git Github 公钥的公共 URL 是什么

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/16158158/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-19 08:27:56  来源:igfitidea点击:

What is the public URL for the Github public keys

gitgithubbitbucketpublic-key

提问by frazras

I heard that there was a public URL for all users on github where you can access their public keys or they can supply that URL of all their public keys. Is this true? If so what is that URL. Does it exist for bitbucket as well?

我听说 github 上的所有用户都有一个公共 URL,您可以在其中访问他们的公钥,或者他们可以提供所有公钥的 URL。这是真的?如果是,那个网址是什么。它也适用于 bitbucket 吗?

回答by frazras

You can get with:

你可以得到:

curl https://github.com/<username>.keys

Replace <username>with the actual username of the GitHub user.

替换<username>为 GitHub 用户的实际用户名。

This is useful when you set login permission to other servers. Just save its output into ~/.ssh/authorized_keys. To append it to the end from the command line:

这在您为其他服务器设置登录权限时很有用。只需将其输出保存到~/.ssh/authorized_keys. 要从命令行将其附加到末尾:

curl https://github.com/<username>.keys | tee -a ~/.ssh/authorized_keys

It can also be done using Github API

也可以使用 Github API 来完成

curl -i https://api.github.com/users/<username>/keys

For bit bucket you can use the following: (This call requires authentication.)

对于位桶,您可以使用以下内容:(此调用需要身份验证。)

curl -i https://bitbucket.org/api/1.0/users/<accountname>/ssh-keys

回答by Brian D

GPG public keys are now available at https://github.com/<username>.gpg

GPG 公钥现在可在 https://github.com/<username>.gpg

回答by Mik R

Works for gitlab same way too.

同样适用于 gitlab。

https://gitlab.com/<username>.keys

Works nicely in bash scripts too.

在 bash 脚本中也能很好地工作。

#GitProvider to fetch public keys (gitlab.com,github.com)
GitProvider="gitlab.com"
GitUsername="username"
curl https://${GitProvider}/${GitUsername}.keys | tee -a ~/.ssh/authorized_keys

回答by kravietz

While the keys are publicyou don't always want to reveal your internal hostnames from the default comment fields, so I'd recommend ssh-copy-idcommand if you have SSH password access, wormholewhen on console and configuration management tools (like Ansible, Puppet etc) in the first place.

虽然密钥是公开的,但您并不总是希望从默认注释字段中显示您的内部主机名,因此,ssh-copy-id如果您有 SSH 密码访问权限,wormhole在控制台和配置管理工具(如 Ansible、Puppet 等)中使用时,我建议您使用command第一名。

回答by Sushen Biswas

Youtube Tutorials for this:

Youtube 教程:

https://www.youtube.com/watch?v=Vi-WqFKYpnw

https://www.youtube.com/watch?v=Vi-WqFKYpnw

Commend :

赞扬:

$ ssh-keygen -t rsa -b 4096 -C "[email protected]"