You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
intro: 'Using the SSH protocol, you can connect and authenticate to remote servers and services. With SSH keys, you can connect to {% data variables.product.product_name %} without supplying your username and {% data variables.product.pat_generic %} at each visit.{% ifversion ssh-commit-verification %} You can also use an SSH key to sign commits.{% endif %}'
When you set up SSH, you will need to generate a new private SSH key and add it to the SSH agent. You must also add the public SSH key to your account on {% data variables.product.product_name %} before you use the key to authenticate{% ifversion ssh-commit-verification %} or sign commits{% endif %}. For more information, see "[Generating a new SSH key and adding it to the ssh-agent](/authentication/connecting-to-github-with-ssh/generating-a-new-ssh-key-and-adding-it-to-the-ssh-agent)"{% ifversion ssh-commit-verification %}, {% else %} and{% endif %} "[Adding a new SSH key to your {% data variables.product.prodname_dotcom %} account](/authentication/connecting-to-github-with-ssh/adding-a-new-ssh-key-to-your-github-account){% ifversion ssh-commit-verification %}" and "[About commit signature verification](/articles/about-commit-signature-verification){% endif %}."
You can further secure your SSH key by using a hardware security key, which requires the physical hardware security key to be attached to your computer when the key pair is used to authenticate with SSH. You can also secure your SSH key by adding your key to the ssh-agent and using a passphrase. For more information, see "[Working with SSH key passphrases](/authentication/connecting-to-github-with-ssh/working-with-ssh-key-passphrases)."
{% ifversion fpt or ghec %}To use your SSH key with a repository owned by an organization that uses SAML single sign-on, you must authorize the key. For more information, see "[Authorizing an SSH key for use with SAML single sign-on](/enterprise-cloud@latest/authentication/authenticating-with-saml-single-sign-on/authorizing-an-ssh-key-for-use-with-saml-single-sign-on){% ifversion fpt %}" in the {% data variables.product.prodname_ghe_cloud %} documentation.{% else %}."{% endif %}{% endif %}
To maintain account security, you can regularly review your SSH keys list and revoke any keys that are invalid or have been compromised. For more information, see "[Reviewing your SSH keys](/github/authenticating-to-github/reviewing-your-ssh-keys)."
26
-
27
-
{% ifversion fpt or ghec %}
28
-
If you haven't used your SSH key for a year, then {% data variables.product.prodname_dotcom %} will automatically delete your inactive SSH key as a security precaution. For more information, see "[Deleted or missing SSH keys](/articles/deleted-or-missing-ssh-keys)."
32
+
{% ifversion fpt or ghec %} 如果一年没有使用 SSH 密钥,则作为安全预防措施,{% data variables.product.prodname_dotcom %} 将自动删除你的非活动 SSH 密钥。 有关详细信息,请参阅“[已删除或缺少的 SSH 密钥](/articles/deleted-or-missing-ssh-keys)”。
29
33
{% endif %}
30
34
31
-
{% ifversion fpt %}
32
-
Organizations that use {% data variables.product.prodname_ghe_cloud %} can provide SSH certificates, which members can use to access that organization's repositories without adding the certificate to their account on {% data variables.product.product_name %}. If you're using an SSH certificate, you cannot use the certificate to access forks of the organization's repositories, if the fork is owned by your personal account. For more information, see "[About SSH certificate authorities](/enterprise-cloud@latest/organizations/managing-git-access-to-your-organizations-repositories/about-ssh-certificate-authorities)" in the {% data variables.product.prodname_ghe_cloud %} documentation.
33
-
{% else ghec or ghes or ghae %}
34
-
If you're a member of an organization that provides SSH certificates, you can use your certificate to access that organization's repositories without adding the certificate to your account on {% data variables.product.product_name %}. You cannot use your certificate to access forks of the organization's repositories, if the forks is owned by your personal account. For more information, see "[About SSH certificate authorities](/organizations/managing-git-access-to-your-organizations-repositories/about-ssh-certificate-authorities)."
35
+
{% ifversion fpt %} 使用 {% data variables.product.prodname_ghe_cloud %} 的组织可以提供 SSH 证书,成员可以使用该证书访问组织的存储库,而无需将其添加到他们在 {% data variables.product.product_name %} 上的帐户。 如果使用 SSH 证书,当分支为个人帐户所有时,将无法使用该证书访问组织存储库的分支。 有关详细信息,请参阅 {% data variables.product.prodname_ghe_cloud %} 文档中的“[关于 SSH 证书颁发机构](/enterprise-cloud@latest/organizations/managing-git-access-to-your-organizations-repositories/about-ssh-certificate-authorities)”。
36
+
{% else ghec or ghes or ghae %} 如果你是提供 SSH 证书的组织成员,可以使用证书来访问组织的存储库,而无需添加证书到你在 {% data variables.product.product_name %} 上的帐户。 当分支为个人帐户所有时,将无法使用该证书访问组织存储库的分支。 有关详细信息,请参阅“[关于 SSH 证书颁发机构](/organizations/managing-git-access-to-your-organizations-repositories/about-ssh-certificate-authorities)”。
intro: 'To sign commits locally, you need to inform Git that there''s a GPG{% ifversion ssh-commit-verification %}, SSH,{% endif %} or X.509 key you''d like to use.'
If you're using a GPG key that matches your committer identity and your verified email address associated with your account on {% ifversion ghae %}{% data variables.product.product_name %}{% else %}{% data variables.location.product_location %}{% endif %}, then you can begin signing commits and signing tags.
29
+
如果您使用与您的提交者身份以及 {% ifversion ghae %}{% data variables.product.product_name %}{% else %}{% data variables.location.product_location %}{% endif %} 上帐户关联的已验证电子邮件地址相匹配的 GPG 密钥,则可以开始对提交和标签进行签名。
24
30
25
31
{% note %}
26
32
27
-
If you don't have a GPG key that matches your committer identity, you need to associate an email with an existing key. For more information, see "[Associating an email with your GPG key](/articles/associating-an-email-with-your-gpg-key)".
If you have multiple GPG keys, you need to tell Git which one to use.
37
+
如果您有多个 GPG 密钥,则需要告知 Git 要使用哪一个。
32
38
33
-
{% data reusables.command_line.open_the_multi_os_terminal %}
34
-
{% data reusables.gpg.configure-gpg-signing %}
35
-
{% data reusables.gpg.list-keys-with-note %}
36
-
{% data reusables.gpg.copy-gpg-key-id %}
37
-
{% data reusables.gpg.paste-gpg-key-id %}
38
-
{% data reusables.gpg.set-auto-sign %}
39
-
1. If you aren't using the GPG suite, run the following command in the `zsh` shell to add the GPG key to your `.zshrc` file, if it exists, or your `.zprofile` file:
39
+
{% data reusables.command_line.open_the_multi_os_terminal %} {% data reusables.gpg.configure-gpg-signing %} {% data reusables.gpg.list-keys-with-note %} {% data reusables.gpg.copy-gpg-key-id %} {% data reusables.gpg.paste-gpg-key-id %} {% data reusables.gpg.set-auto-sign %}
@@ -57,70 +58,56 @@ If you have multiple GPG keys, you need to tell Git which one to use.
57
58
58
59
{% windows %}
59
60
60
-
## Telling Git about your GPG key
61
+
## 将您的 GPG 密钥告知 Git
61
62
62
-
If you're using a GPG key that matches your committer identity and your verified email address associated with your account on {% ifversion ghae %}{% data variables.product.product_name %}{% else %}{% data variables.location.product_location %}{% endif %}, then you can begin signing commits and signing tags.
63
+
如果您使用与您的提交者身份以及 {% ifversion ghae %}{% data variables.product.product_name %}{% else %}{% data variables.location.product_location %}{% endif %} 上帐户关联的已验证电子邮件地址相匹配的 GPG 密钥,则可以开始对提交和标签进行签名。
63
64
64
65
{% note %}
65
66
66
-
If you don't have a GPG key that matches your committer identity, you need to associate an email with an existing key. For more information, see "[Associating an email with your GPG key](/articles/associating-an-email-with-your-gpg-key)".
If you have multiple GPG keys, you need to tell Git which one to use.
71
+
如果您有多个 GPG 密钥,则需要告知 Git 要使用哪一个。
71
72
72
-
{% data reusables.command_line.open_the_multi_os_terminal %}
73
-
{% data reusables.gpg.configure-gpg-signing %}
74
-
{% data reusables.gpg.list-keys-with-note %}
75
-
{% data reusables.gpg.copy-gpg-key-id %}
76
-
{% data reusables.gpg.paste-gpg-key-id %}
77
-
{% data reusables.gpg.set-auto-sign %}
73
+
{% data reusables.command_line.open_the_multi_os_terminal %} {% data reusables.gpg.configure-gpg-signing %} {% data reusables.gpg.list-keys-with-note %} {% data reusables.gpg.copy-gpg-key-id %} {% data reusables.gpg.paste-gpg-key-id %} {% data reusables.gpg.set-auto-sign %}
78
74
79
75
{% endwindows %}
80
76
81
77
{% linux %}
82
78
83
-
## Telling Git about your GPG key
79
+
## 将您的 GPG 密钥告知 Git
84
80
85
-
If you're using a GPG key that matches your committer identity and your verified email address associated with your account on {% ifversion ghae %}{% data variables.product.product_name %}{% else %}{% data variables.location.product_location %}{% endif %}, then you can begin signing commits and signing tags.
81
+
如果您使用与您的提交者身份以及 {% ifversion ghae %}{% data variables.product.product_name %}{% else %}{% data variables.location.product_location %}{% endif %} 上帐户关联的已验证电子邮件地址相匹配的 GPG 密钥,则可以开始对提交和标签进行签名。
86
82
87
83
{% note %}
88
84
89
-
If you don't have a GPG key that matches your committer identity, you need to associate an email with an existing key. For more information, see "[Associating an email with your GPG key](/articles/associating-an-email-with-your-gpg-key)".
If you have multiple GPG keys, you need to tell Git which one to use.
89
+
如果您有多个 GPG 密钥,则需要告知 Git 要使用哪一个。
94
90
95
-
{% data reusables.command_line.open_the_multi_os_terminal %}
96
-
{% data reusables.gpg.configure-gpg-signing %}
97
-
{% data reusables.gpg.list-keys-with-note %}
98
-
{% data reusables.gpg.copy-gpg-key-id %}
99
-
{% data reusables.gpg.paste-gpg-key-id %}
100
-
{% data reusables.gpg.set-auto-sign %}
101
-
1. To add your GPG key to your `.bashrc` startup file, run the following command:
91
+
{% data reusables.command_line.open_the_multi_os_terminal %} {% data reusables.gpg.configure-gpg-signing %} {% data reusables.gpg.list-keys-with-note %} {% data reusables.gpg.copy-gpg-key-id %} {% data reusables.gpg.paste-gpg-key-id %} {% data reusables.gpg.set-auto-sign %}
You can use an existing SSH key to sign commits and tags, or generate a new one specifically for signing. For more information, see "[Generating a new SSH key and adding it to the ssh-agent](/github/authenticating-to-github/generating-a-new-ssh-key-and-adding-it-to-the-ssh-agent)."
{% data reusables.command_line.open_the_multi_os_terminal %}
115
-
{% data reusables.gpg.configure-ssh-signing %}
116
-
{% data reusables.gpg.copy-ssh-public-key %}
117
-
{% data reusables.gpg.paste-ssh-public-key %}
104
+
{% data reusables.command_line.open_the_multi_os_terminal %} {% data reusables.gpg.configure-ssh-signing %} {% data reusables.gpg.copy-ssh-public-key %} {% data reusables.gpg.paste-ssh-public-key %}
118
105
119
106
{% endif %}
120
107
121
108
{% data reusables.gpg.x-509-key %}
122
-
## Further reading
109
+
## 延伸阅读
123
110
124
-
-"[Adding a new SSH key to your GitHub account](/authentication/connecting-to-github-with-ssh/adding-a-new-ssh-key-to-your-github-account)."
0 commit comments