1
0
mirror of synced 2025-12-30 12:02:01 -05:00

New translation batch for cn (#24631)

* Add crowdin translations

* Run script/i18n/homogenize-frontmatter.js

* Run script/i18n/lint-translation-files.js --check parsing

* Run script/i18n/lint-translation-files.js --check rendering

* run script/i18n/reset-files-with-broken-liquid-tags.js --language=cn

* run script/i18n/reset-known-broken-translation-files.js

* Check in cn CSV report

* remove now orphaned assets

Co-authored-by: Peter Bengtsson <peterbe@github.com>
Co-authored-by: Peter Bengtsson <mail@peterbe.com>
This commit is contained in:
docubot
2022-01-27 02:05:10 +10:00
committed by GitHub
parent 1e4099ca86
commit 300a6296e5
155 changed files with 2865 additions and 437 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 24 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 25 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 26 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 34 KiB

View File

@@ -122,16 +122,16 @@ translations/zh-CN/content/education/explore-the-benefits-of-teaching-and-learni
translations/zh-CN/content/education/manage-coursework-with-github-classroom/integrate-github-classroom-with-an-ide/about-using-makecode-arcade-with-github-classroom.md,broken liquid tags
translations/zh-CN/content/education/manage-coursework-with-github-classroom/learn-with-github-classroom/view-autograding-results.md,broken liquid tags
translations/zh-CN/content/get-started/getting-started-with-git/updating-credentials-from-the-macos-keychain.md,broken liquid tags
translations/zh-CN/content/get-started/importing-your-projects-to-github/importing-source-code-to-github/adding-an-existing-project-to-github-using-the-command-line.md,broken liquid tags
translations/zh-CN/content/get-started/learning-about-github/about-github-advanced-security.md,broken liquid tags
translations/zh-CN/content/get-started/privacy-on-github/managing-data-use-settings-for-your-private-repository.md,broken liquid tags
translations/zh-CN/content/get-started/quickstart/communicating-on-github.md,broken liquid tags
translations/zh-CN/content/get-started/quickstart/git-and-github-learning-resources.md,broken liquid tags
translations/zh-CN/content/get-started/quickstart/github-flow.md,broken liquid tags
translations/zh-CN/content/get-started/using-git/dealing-with-non-fast-forward-errors.md,broken liquid tags
translations/zh-CN/content/get-started/using-github/github-mobile.md,broken liquid tags
translations/zh-CN/content/get-started/writing-on-github/editing-and-sharing-content-with-gists/creating-gists.md,broken liquid tags
translations/zh-CN/content/github/customizing-your-github-workflow/exploring-integrations/about-github-marketplace.md,broken liquid tags
translations/zh-CN/content/github/importing-your-projects-to-github/importing-source-code-to-github/adding-an-existing-project-to-github-using-the-command-line.md,broken liquid tags
translations/zh-CN/content/github/understanding-how-github-uses-and-protects-your-data/managing-data-use-settings-for-your-private-repository.md,broken liquid tags
translations/zh-CN/content/github/writing-on-github/editing-and-sharing-content-with-gists/creating-gists.md,broken liquid tags
translations/zh-CN/content/issues/using-labels-and-milestones-to-track-work/managing-labels.md,broken liquid tags
translations/zh-CN/content/organizations/keeping-your-organization-secure/reviewing-the-audit-log-for-your-organization.md,Listed in localization-support#489
translations/zh-CN/content/organizations/managing-organization-settings/managing-the-default-branch-name-for-repositories-in-your-organization.md,broken liquid tags
@@ -209,6 +209,5 @@ translations/zh-CN/data/reusables/repositories/github-reviews-security-advisorie
translations/zh-CN/data/reusables/saml/you-must-periodically-authenticate.md,Listed in localization-support#489
translations/zh-CN/data/reusables/saml/you-must-periodically-authenticate.md,parsing error
translations/zh-CN/data/reusables/scim/after-you-configure-saml.md,broken liquid tags
translations/zh-CN/data/reusables/secret-scanning/about-secret-scanning.md,broken liquid tags
translations/zh-CN/data/reusables/secret-scanning/enterprise-enable-secret-scanning.md,broken liquid tags
translations/zh-CN/data/reusables/sponsors/feedback.md,broken liquid tags
1 file reason
122 translations/zh-CN/content/education/manage-coursework-with-github-classroom/integrate-github-classroom-with-an-ide/about-using-makecode-arcade-with-github-classroom.md broken liquid tags
123 translations/zh-CN/content/education/manage-coursework-with-github-classroom/learn-with-github-classroom/view-autograding-results.md broken liquid tags
124 translations/zh-CN/content/get-started/getting-started-with-git/updating-credentials-from-the-macos-keychain.md broken liquid tags
125 translations/zh-CN/content/get-started/importing-your-projects-to-github/importing-source-code-to-github/adding-an-existing-project-to-github-using-the-command-line.md broken liquid tags
126 translations/zh-CN/content/get-started/learning-about-github/about-github-advanced-security.md broken liquid tags
127 translations/zh-CN/content/get-started/privacy-on-github/managing-data-use-settings-for-your-private-repository.md broken liquid tags
128 translations/zh-CN/content/get-started/quickstart/communicating-on-github.md broken liquid tags
129 translations/zh-CN/content/get-started/quickstart/git-and-github-learning-resources.md broken liquid tags
130 translations/zh-CN/content/get-started/quickstart/github-flow.md broken liquid tags
131 translations/zh-CN/content/get-started/using-git/dealing-with-non-fast-forward-errors.md broken liquid tags
132 translations/zh-CN/content/get-started/using-github/github-mobile.md broken liquid tags
133 translations/zh-CN/content/get-started/writing-on-github/editing-and-sharing-content-with-gists/creating-gists.md broken liquid tags
134 translations/zh-CN/content/github/customizing-your-github-workflow/exploring-integrations/about-github-marketplace.md broken liquid tags
translations/zh-CN/content/github/importing-your-projects-to-github/importing-source-code-to-github/adding-an-existing-project-to-github-using-the-command-line.md broken liquid tags
translations/zh-CN/content/github/understanding-how-github-uses-and-protects-your-data/managing-data-use-settings-for-your-private-repository.md broken liquid tags
translations/zh-CN/content/github/writing-on-github/editing-and-sharing-content-with-gists/creating-gists.md broken liquid tags
135 translations/zh-CN/content/issues/using-labels-and-milestones-to-track-work/managing-labels.md broken liquid tags
136 translations/zh-CN/content/organizations/keeping-your-organization-secure/reviewing-the-audit-log-for-your-organization.md Listed in localization-support#489
137 translations/zh-CN/content/organizations/managing-organization-settings/managing-the-default-branch-name-for-repositories-in-your-organization.md broken liquid tags
209 translations/zh-CN/data/reusables/saml/you-must-periodically-authenticate.md Listed in localization-support#489
210 translations/zh-CN/data/reusables/saml/you-must-periodically-authenticate.md parsing error
211 translations/zh-CN/data/reusables/scim/after-you-configure-saml.md broken liquid tags
translations/zh-CN/data/reusables/secret-scanning/about-secret-scanning.md broken liquid tags
212 translations/zh-CN/data/reusables/secret-scanning/enterprise-enable-secret-scanning.md broken liquid tags
213 translations/zh-CN/data/reusables/sponsors/feedback.md broken liquid tags

View File

@@ -101,4 +101,4 @@ topics:
## 反馈和支持
如果您对通知有反馈或功能请求,请使用[通知反馈表](https://support.github.com/contact/feedback?contact%5Bcategory%5D=notifications&contact%5Bsubject%5D=Product+feedback)
If you have feedback or feature requests for notifications, use a [{% data variables.product.product_name %} feedback discussion](https://github.com/github/feedback/discussions/categories/general-feedback).

View File

@@ -89,7 +89,7 @@ If you use your `noreply` email address for {% data variables.product.product_na
{% data variables.product.product_name %} uses the email address set in your local Git configuration to associate commits pushed from the command line with your account on {% data variables.product.product_location %}.
您可以更改与您在一个仓库中所进行的提交关联的电子邮件地址。 此操作将覆盖这一个仓库中的全局 Git 配置设置,但不会影响任何其他仓库。
您可以更改与您在一个仓库中所进行的提交关联的电子邮件地址。 This will override your global Git configuration settings in this one repository, but will not affect any other repositories.
{% data reusables.command_line.open_the_multi_os_terminal %}
2. 将当前工作目录更改为您想要在其中配置与 Git 提交关联的电子邮件地址的本地仓库。

View File

@@ -51,7 +51,7 @@ shortTitle: 权限用户仓库
| 从仓库创建模板 | "[创建模板仓库](/github/creating-cloning-and-archiving-repositories/creating-a-template-repository)" |{% ifversion fpt or ghes or ghae-issue-4864 or ghec %}
| Control access to {% data variables.product.prodname_dependabot_alerts %} for vulnerable dependencies | "[管理仓库的安全和分析设置](/repositories/managing-your-repositorys-settings-and-features/enabling-features-for-your-repository/managing-security-and-analysis-settings-for-your-repository#granting-access-to-security-alerts)" |{% endif %}{% ifversion fpt or ghec %}
| 忽略仓库中的 {% data variables.product.prodname_dependabot_alerts %} | "[查看和更新仓库中的漏洞依赖项](/github/managing-security-vulnerabilities/viewing-and-updating-vulnerable-dependencies-in-your-repository)" |
| 管理私有仓库的数据使用 | “[管理私有仓库的数据使用设置](/github/understanding-how-github-uses-and-protects-your-data/managing-data-use-settings-for-your-private-repository)”
| 管理私有仓库的数据使用 | “[管理私有仓库的数据使用设置](/get-started/privacy-on-github/managing-data-use-settings-for-your-private-repository)”
{% endif %}
| 定义仓库的代码所有者 | "[关于代码所有者](/github/creating-cloning-and-archiving-repositories/about-code-owners)" |
| 存档仓库 | "[Archiving repositories](/repositories/archiving-a-github-repository/archiving-repositories)" |{% ifversion fpt or ghec %}

View File

@@ -35,7 +35,7 @@ If your organization uses {% data variables.product.prodname_ghe_cloud %}, you c
If your organization is managed by an enterprise account, then you can view the enterprise owners who manage billing settings and policies for all of your enterprise's organizations. For more information about enterprise accounts, see "[Types of {% data variables.product.prodname_dotcom %} accounts](/get-started/learning-about-github/types-of-github-accounts)."
You can also view whether an enterprise owner has a specific role in the organization. Enterprise owners can also be an organization member, any other organization role, or be unaffililated with the organization.
You can also view whether an enterprise owner has a specific role in the organization. Enterprise owners can also be an organization member, any other organization role, or be un-affililated with the organization.
{% note %}
@@ -43,11 +43,11 @@ You can also view whether an enterprise owner has a specific role in the organiz
{% endnote %}
| **Enterprise role** | **Organization role** | **Organization access or impact** |
| ------------------- | ---------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------ |
| 企业所有者 | Unaffililated or no official organization role | Cannot access organization content or repositories but manages enterprise settings and policies that impact your organization. |
| 企业所有者 | Organization owner | Able to configure organization settings and manage access to the organization's resources through teams, etc. |
| 企业所有者 | Organization member | Able to access organization resources and content, such as repositories, without access to the organization's settings. |
| **Enterprise role** | **Organization role** | **Organization access or impact** |
| ------------------- | ----------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------ |
| 企业所有者 | Un-affililated or no official organization role | Cannot access organization content or repositories but manages enterprise settings and policies that impact your organization. |
| 企业所有者 | Organization owner | Able to configure organization settings and manage access to the organization's resources through teams, etc. |
| 企业所有者 | Organization member | Able to access organization resources and content, such as repositories, without access to the organization's settings. |
To review all roles in an organization, see "[Roles in an organization](/organizations/managing-peoples-access-to-your-organization-with-roles/roles-in-an-organization)." {% ifversion ghec %} An organization member can also have a custom role for a specific repository. For more information, see "[Managing custom repository roles for an organization](/organizations/managing-peoples-access-to-your-organization-with-roles/managing-custom-repository-roles-for-an-organization)."{% endif %}

View File

@@ -88,7 +88,7 @@ The default starter workflows are excellent starting points when creating your b
初学者工作流程将运行 _build.xml_ 文件中指定的默认目标。 默认目标通常设置为将类、运行测试和包类设置为其可分发格式,例如 JAR 文件。
如果使用不同的命令来构建项目,或者想要运行不同的目标,则可以指定这些命令。 例如,您可能想要运行在 _build-ci.xml_ 文件中配置的 `jar` 目标。
如果使用不同的命令来构建项目,或者想要运行不同的目标,则可以指定这些命令。 For example, you may want to run the `jar` target that's configured in your `_build-ci.xml_` file.
{% raw %}
```yaml{:copy}

View File

@@ -35,6 +35,7 @@ shortTitle: 构建和测试 .NET
To get started quickly, add the starter workflow to the `.github/workflows` directory of your repository.
{% raw %}
```yaml
name: dotnet package
@@ -61,6 +62,7 @@ jobs:
- name: Test
run: dotnet test --no-restore --verbosity normal
```
{% endraw %}
## 指定 .NET 版本
@@ -227,7 +229,7 @@ jobs:
## 发布到包注册表
您可以配置工作流程在 CI 测试通过后将 Dotnet 包发布到包注册表。 您可以使用仓库机密来存储发布二进制文件所需的任何令牌或凭据。 下面的示例使用 `dotnet core cli`创建并发布软件包到 {% data variables.product.prodname_registry %}。
You can configure your workflow to publish your .NET package to a package registry when your CI tests pass. 您可以使用仓库机密来存储发布二进制文件所需的任何令牌或凭据。 下面的示例使用 `dotnet core cli`创建并发布软件包到 {% data variables.product.prodname_registry %}。
```yaml
name: Upload dotnet package

View File

@@ -189,7 +189,7 @@ steps:
run: yarn
```
或者,您可以传递 `--frozen-lockfile` 来安装 *yarn.lock* 文件中的版本,并阻止更新 *yarn.lock* 文件。
或者,您可以传递 `--frozen-lockfile` 来安装 `yarn.lock` 文件中的版本,并阻止更新 `yarn.lock` 文件。
```yaml{:copy}
steps:

View File

@@ -44,7 +44,7 @@ This guide explains how to use {% data variables.product.prodname_actions %} to
The following example workflow demonstrates how to build and deploy a project to Azure Kubernetes Service when code is pushed to your repository.
Under the workflow `env` key, change the the following values:
Under the workflow `env` key, change the following values:
- `AZURE_CONTAINER_REGISTRY` to the name of your container registry
- `PROJECT_NAME` to the name of your project
- `RESOURCE_GROUP` to the resource group containing your AKS cluster

View File

@@ -114,7 +114,7 @@ $ gcloud services enable \
Store the name of your project as a secret named `GKE_PROJECT`. For more information about how to store a secret, see "[Encrypted secrets](/actions/security-guides/encrypted-secrets)."
### (可选)配置 kustomize
Kustomize 是用于管理 YAML 规范的可选工具。 在创建 _kustomization_ 文件之后, 下面的工作流可用于将结果中的图像和管道字段动态设置为 `kubectl` 更多信息请参阅 [kustomize 的用法](https://github.com/kubernetes-sigs/kustomize#usage)。
Kustomize 是用于管理 YAML 规范的可选工具。 After creating a `kustomization` file, the workflow below can be used to dynamically set fields of the image and pipe in the result to `kubectl`. 更多信息请参阅 [kustomize 的用法](https://github.com/kubernetes-sigs/kustomize#usage)。
{% ifversion fpt or ghes > 3.0 or ghae or ghec %}
### (Optional) Configure a deployment environment

View File

@@ -19,7 +19,7 @@ topics:
OpenID Connect (OIDC) allows your {% data variables.product.prodname_actions %} workflows to authenticate with a HashiCorp Vault to retrieve secrets.
This guide gives an overview of how to configure HashiCorp Vault to trust {% data variables.product.prodname_dotcom %}'s OIDC as a federated identity, and demonstrates how to use this configuration in [`hashicorp/vault-action`](https://github.com/hashicorp/vault-action) to retrieve secrets from HashiCorp Vault.
This guide gives an overview of how to configure HashiCorp Vault to trust {% data variables.product.prodname_dotcom %}'s OIDC as a federated identity, and demonstrates how to use this configuration in the [hashicorp/vault-action](https://github.com/hashicorp/vault-action) action to retrieve secrets from HashiCorp Vault.
## 基本要求

View File

@@ -80,14 +80,14 @@ Feb 11 16:06:54 runner01 runsvc.sh[962]: 2020-02-11 16:06:54Z: Running job: test
Feb 11 16:07:10 runner01 runsvc.sh[962]: 2020-02-11 16:07:10Z: Job testAction completed with result: Succeeded
```
To view the systemd configuration, you can locate the service file here: `/etc/systemd/system/actions.runner.<org>-<repo>.<runnerName>.service`.
To view the `systemd` configuration, you can locate the service file here: `/etc/systemd/system/actions.runner.<org>-<repo>.<runnerName>.service`.
If you want to customize the self-hosted runner application service, do not directly modify this file. Follow the instructions described in "[Configuring the self-hosted runner application as a service](/actions/hosting-your-own-runners/configuring-the-self-hosted-runner-application-as-a-service#customizing-the-self-hosted-runner-service)."
{% endlinux %}
{% mac %}
## Using launchd to check the self-hosted runner application service
## Using `launchd` to check the self-hosted runner application service
For macOS-based self-hosted runners running the application as a service, you can use `launchctl` to monitor their real-time activity. The default launchd-based service uses the following naming convention: `actions.runner.<org>-<repo>.<runnerName>`. This name is truncated if it exceeds 80 characters, so the preferred way of finding the service's name is by checking the _.service_ file in the runner directory:
@@ -106,9 +106,9 @@ Started:
379 0 actions.runner.example.runner01
```
The resulting output includes the process ID and the name of the applications launchd service.
The resulting output includes the process ID and the name of the applications `launchd` service.
To view the launchd configuration, you can locate the service file here: `/Users/exampleUsername/Library/LaunchAgents/actions.runner.<repoName>.<runnerName>.service`.
To view the `launchd` configuration, you can locate the service file here: `/Users/exampleUsername/Library/LaunchAgents/actions.runner.<repoName>.<runnerName>.service`.
If you want to customize the self-hosted runner application service, do not directly modify this file. Follow the instructions described in "[Configuring the self-hosted runner application as a service](/actions/hosting-your-own-runners/configuring-the-self-hosted-runner-application-as-a-service#customizing-the-self-hosted-runner-service-1)."
{% endmac %}
@@ -196,7 +196,7 @@ If your job fails with the following error:
dial unix /var/run/docker.sock: connect: permission denied
```
Check that the self-hosted runner's service account has permission to use the Docker service. You can identify this account by checking the configuration of the self-hosted runner in systemd. For example:
Check that the self-hosted runner's service account has permission to use the Docker service. You can identify this account by checking the configuration of the self-hosted runner in `systemd`. For example:
```shell
$ sudo systemctl show -p User actions.runner.octo-org-octo-repo.runner01.service

View File

@@ -18,73 +18,175 @@ versions:
## 关于环境变量
{% data variables.product.prodname_dotcom %} 设置适用于工作流程运行中每个步骤的默认环境变量。 环境变量区分大小写。 在操作或步骤中运行的命令可以创建、读取和修改环境变量。
You can use environment variables to store information that you want to reference in your workflow. You reference environment variables within a workflow step or an action, and the variables are interpolated on the runner machine that runs your workflow. Commands that run in actions or workflow steps can create, read, and modify environment variables.
要设置自定义环境变量,您需要在工作流程文件中指定变量。 您可以使用 [`jobs.<job_id>.steps[*].env`](/github/automating-your-workflow-with-github-actions/workflow-syntax-for-github-actions#jobsjob_idstepsenv)、[`jobs.<job_id>.env`](/github/automating-your-workflow-with-github-actions/workflow-syntax-for-github-actions#jobsjob_idenv) 和 [`env`](/github/automating-your-workflow-with-github-actions/workflow-syntax-for-github-actions#env) 关键字定义步骤、作业或整个工作流程的环境变量。 更多信息请参阅“[{% data variables.product.prodname_dotcom %} 的工作流程语法](/articles/workflow-syntax-for-github-actions/#jobsjob_idstepsenv)”
You can set your own custom environment variables, you can use the default environment variables that {% data variables.product.prodname_dotcom %} sets automatically, and you can also use any other environment variables that are set in the working environment on the runner. 环境变量区分大小写
To set a custom environment variable, you must define it in the workflow file. The scope of a custom environment variable is limited to the element in which it is defined. You can define environment variables that are scoped for:
* The entire workflow, by using [`env`](/actions/using-workflows/workflow-syntax-for-github-actions#env) at the top level of the workflow file.
* The contents of a job within a workflow, by using [`jobs.<job_id>.env`](/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idenv).
* A specific step within a job, by using [`jobs.<job_id>.steps[*].env`](/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsenv).
{% raw %}
```yaml
name: Greeting on variable day
on:
workflow_dispatch
env:
DAY_OF_WEEK: Monday
jobs:
greeting_job:
runs-on: ubuntu-latest
env:
Greeting: Hello
steps:
- name: "Say Hello Mona it's Monday"
run: echo "$Greeting $First_Name. Today is $DAY_OF_WEEK!"
env:
First_Name: Mona
```
{% endraw %}
The example above shows three custom environment variables being used in an `echo` command: `$DAY_OF_WEEK`, `$Greeting`, and `$First_Name`. The values for these environment variables are set, and scoped, at the workflow, job, and step level respectively.
Because environment variable interpolation is done after a workflow job is sent to a runner machine, you must use the appropriate syntax for the shell that's used on the runner. In this example, the workflow specifies `ubuntu-latest`. By default, Linux runners use the bash shell, so you must use the syntax `$NAME`. If the workflow specified a Windows runner, you would use the syntax for PowerShell, `$env:NAME`. For more information about shells, see "[Workflow syntax for {% data variables.product.prodname_actions %}](/actions/learn-github-actions/workflow-syntax-for-github-actions#jobsjob_idstepsshell)."
{% note %}
**Note**: You can list the entire set of environment variables that are available to a workflow step by using <span style="white-space: nowrap;">`run: env`</span> in a step and then examining the output for the step.
{% endnote %}
## Using contexts to access environment variable values
In addition to environment variables, {% data variables.product.prodname_actions %} also allows you to set and read values using contexts. Environment variables and contexts are intended for use at different points in the workflow.
Environment variables are always interpolated on the virtual machine runner. However, parts of a workflow are processed by {% data variables.product.prodname_actions %} and are not sent to the runner. You cannot use environment variables in these parts of a workflow file. Instead, you can use contexts. For example, an `if` conditional, which determines whether a job or step is sent to the runner, is always processed by {% data variables.product.prodname_actions %}. You can use a context in an `if` conditional statement to access the value of an environment variable.
{% raw %}
```yaml
env:
DAY_OF_WEEK: Monday
jobs:
greeting_job:
runs-on: ubuntu-latest
env:
Greeting: Hello
steps:
- name: "Say Hello Mona it's Monday"
if: ${{ env.DAY_OF_WEEK == 'Monday' }}
run: echo "$Greeting $First_Name. Today is $DAY_OF_WEEK!"
env:
First_Name: Mona
```
{% endraw %}
In this modification of the first example, we've introduced an `if` conditional. The workflow step is now only run if `DAYS_OF_WEEK` is set to "Monday". We access this value from the `if` conditional statement by using the [`env` context](/actions/learn-github-actions/contexts#env-context).
{% note %}
**Note**: Contexts are usually denoted using the dollar sign and curly braces, as {% raw %}`${{ context.property }}`{% endraw %}. In an `if` conditional, the {% raw %}`${{` and `}}`{% endraw %} are optional, but if you use them they must enclose the entire comparison statement, as shown above.
{% endnote %}
You will commonly use either the `env` or `github` context to access environment variable values in parts of the workflow that are processed before jobs are sent to runners.
| 上下文 | Use case | 示例 |
| -------- | ---------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------- |
| `env` | Reference custom environment variables defined in the workflow. | <span style="white-space: nowrap;">{% raw %}`${{ env.MY_VARIABLE }}`{% endraw %}</span> |
| `github` | Reference information about the workflow run and the event that triggered the run. | <span style="white-space: nowrap;">{% raw %}`${{ github.repository }}`{% endraw %}</span> |
There are many other contexts that you can use for a variety of purposes in your workflows. 更多信息请参阅“[上下文](/actions/learn-github-actions/contexts)”。 For details of where you can use specific contexts within a workflow, see "[Context availability](/actions/learn-github-actions/contexts#context-availability)."
### Other types of variables
In most places in a workflow, the only types of variables that you can use are either environment variables, such as `$MY_VARIABLE`, or the equivalent context property, such as <span style="white-space: nowrap;">{% raw %}`${{ env.MY_VARIABLE }}`{% endraw %}</span>. Exceptions are:
* Inputs for the `workflow_call` and `workflow_dispatch` events, which allow you to pass values to a workflow. For more information, see [`on.workflow_call.inputs`](/actions/learn-github-actions/workflow-syntax-for-github-actions#onworkflow_callinputs) and [`on.workflow_dispatch.inputs`](/actions/learn-github-actions/workflow-syntax-for-github-actions#onworkflow_dispatchinputs).
* Job outputs, which allow you to pass values between jobs in a workflow. For more information, see [`jobs.<job_id>.outputs`](/actions/learn-github-actions/workflow-syntax-for-github-actions#jobsjob_idoutputs).
* The variables in a format expression, which allow you to replace parts of a string. For more information, see [`format`](/actions/learn-github-actions/expressions#format).
## 环境变量命名约定
When you set a custom environment variable, you cannot use any of the default environment variable names. For a complete list of these, see "[Default environment variables](#default-environment-variables)" below. 如果尝试重写其中一个默认环境变量的值,则会忽略赋值。
您设置的指向文件系统上某个位置的任何新环境变量都应该有 `_PATH` 后缀。 The `HOME`, `GITHUB_ENV`, and `GITHUB_WORKSPACE` default environment variables are exceptions to this convention.
## 默认环境变量
The default environment variables that {% data variables.product.prodname_dotcom %} sets are available to every step in a workflow.
强烈建议操作使用环境变量访问文件系统,而非使用硬编码的文件路径。 {% data variables.product.prodname_dotcom %} 设置供操作用于所有运行器环境中的环境变量。
| 环境变量 | 描述 |
| -------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `CI` | 始终设置为 `true`。 |
| `GITHUB_ACTION` | The name of the action currently running, or the [`id`](/actions/learn-github-actions/workflow-syntax-for-github-actions#jobsjob_idstepsid) of a step. For example, for an action, `__repo-owner_name-of-action-repo`.<br><br>{% data variables.product.prodname_dotcom %} removes special characters, and uses the name `__run` when the current step runs a script without an `id`. If you use the same script or action more than once in the same job, the name will include a suffix that consists of the sequence number preceded by an underscore. For example, the first script you run will have the name `__run`, and the second script will be named `__run_2`. 同样,`actions/checkout` 第二次调用时将变成 `actionscheckout2`。 |
| `GITHUB_ACTION_PATH` | The path where an action is located. This property is only supported in composite actions. You can use this path to access files located in the same repository as the action. For example, `/home/runner/work/_actions/repo-owner/name-of-action-repo/v1`. |
| `GITHUB_ACTION_REPOSITORY` | For a step executing an action, this is the owner and repository name of the action. For example, `actions/checkout`. |
| `GITHUB_ACTIONS` | 当 {% data variables.product.prodname_actions %} 运行工作流程时,始终设置为 `true`。 您可以使用此变量来区分测试是在本地运行还是通过 {% data variables.product.prodname_actions %} 运行。 |
| `GITHUB_ACTOR` | 发起工作流程的个人或应用程序的名称。 例如 `octocat`。 |
| `GITHUB_API_URL` | 返回 API URL。 For example: `{% data variables.product.api_url_code %}`. |
| `GITHUB_BASE_REF` | The name of the base ref or target branch of the pull request in a workflow run. This is only set when the event that triggers a workflow run is either `pull_request` or `pull_request_target`. For example, `main`. |
| `GITHUB_ENV` | The path on the runner to the file that sets environment variables from workflow commands. This file is unique to the current step and changes for each step in a job. For example, `/home/runner/work/_temp/_runner_file_commands/set_env_87406d6e-4979-4d42-98e1-3dab1f48b13a`. 更多信息请参阅“[{% data variables.product.prodname_actions %} 的工作流程命令](/actions/using-workflows/workflow-commands-for-github-actions#setting-an-environment-variable)”。 |
| `GITHUB_EVENT_NAME` | The name of the event that triggered the workflow. For example, `workflow_dispatch`. |
| `GITHUB_EVENT_PATH` | The path to the file on the runner that contains the full event webhook payload. 例如 `/github/workflow/event.json`。 |
| `GITHUB_GRAPHQL_URL` | 返回 GraphQL API URL。 For example: `{% data variables.product.graphql_url_code %}`. |
| `GITHUB_HEAD_REF` | The head ref or source branch of the pull request in a workflow run. This property is only set when the event that triggers a workflow run is either `pull_request` or `pull_request_target`. For example, `feature-branch-1`. |
| `GITHUB_JOB` | 当前作业的 [job_id](/actions/reference/workflow-syntax-for-github-actions#jobsjob_id)。 For example, `greeting_job`. |
| `GITHUB_PATH` | The path on the runner to the file that sets system `PATH` variables from workflow commands. This file is unique to the current step and changes for each step in a job. For example, `/home/runner/work/_temp/_runner_file_commands/add_path_899b9445-ad4a-400c-aa89-249f18632cf5`. 更多信息请参阅“[{% data variables.product.prodname_actions %} 的工作流程命令](/actions/using-workflows/workflow-commands-for-github-actions#adding-a-system-path)”。 |
| `GITHUB_REF` | 触发工作流程的分支或标记参考。 For branches this is the format `refs/heads/<branch_name>`, and for tags it is `refs/tags/<tag_name>`. This variable is only set if a branch or tag is available for the event type. 例如 `refs/heads/feature-branch-1`。 |
{%- ifversion fpt or ghec or ghes > 3.3 or ghae-issue-5338 %}
| `GITHUB_REF_NAME` | {% data reusables.actions.ref_name-description %} For example, `feature-branch-1`.| | `GITHUB_REF_PROTECTED` | {% data reusables.actions.ref_protected-description %} | | `GITHUB_REF_TYPE` | {% data reusables.actions.ref_type-description %}
{%- endif %}
| `GITHUB_REPOSITORY` | The owner and repository name. 例如 `octocat/Hello-World`。 | | `GITHUB_REPOSITORY_OWNER` | The repository owner's name. 例如 `octocat`。 | | `GITHUB_RETENTION_DAYS` | The number of days that workflow run logs and artifacts are kept. For example, `90`. | | `GITHUB_RUN_ATTEMPT` | A unique number for each attempt of a particular workflow run in a repository. This number begins at 1 for the workflow run's first attempt, and increments with each re-run. For example, `3`. | | `GITHUB_RUN_ID` | {% data reusables.github-actions.run_id_description %} For example, `1658821493`. | | `GITHUB_RUN_NUMBER` | {% data reusables.github-actions.run_number_description %} For example, `3`. | | `GITHUB_SERVER_URL`| The URL of the {% data variables.product.product_name %} server. For example: `https://{% data variables.product.product_url %}`. | `GITHUB_SHA` | The commit SHA that triggered the workflow. 例如 `ffac537e6cbbf934b08745a378932722df287a53`。 | | `GITHUB_WORKFLOW` | The name of the workflow. For example, `My test workflow`. If the workflow file doesn't specify a `name`, the value of this variable is the full path of the workflow file in the repository. | | `GITHUB_WORKSPACE` | The default working directory on the runner for steps, and the default location of your repository when using the [`checkout`](https://github.com/actions/checkout) action. 例如 `/home/runner/work/my-repo-name/my-repo-name`。 |
{%- if actions-runner-arch-envvars %}
| `RUNNER_ARCH` | {% data reusables.actions.runner-arch-description %}
{%- endif %}
| `RUNNER_NAME` | {% data reusables.actions.runner-name-description %} For example, `Hosted Agent` | | `RUNNER_OS` | {% data reusables.actions.runner-os-description %} For example, `Windows` | | `RUNNER_TEMP` | {% data reusables.actions.runner-temp-directory-description %} For example, `D:\a\_temp` |
{% ifversion not ghae %}| `RUNNER_TOOL_CACHE` | {% data reusables.actions.runner-tool-cache-description %} For example, `C:\hostedtoolcache\windows` |{% endif %}
{% note %}
**注:**
* If you need to use a workflow run's URL from within a job, you can combine these environment variables: `$GITHUB_SERVER_URL/$GITHUB_REPOSITORY/actions/runs/$GITHUB_RUN_ID`
* Most of the default environment variables have a corresponding, and similarly named, context property. For example, the value of the `GITHUB_REF` environment variable can be read during workflow processing using the {% raw %}`${{ github.ref }}`{% endraw %} context property.
{% endnote %}
## Detecting the operating system
You can write a single workflow file that can be used for different operating systems by using the `RUNNER_OS` default environment variable and the corresponding context property <span style="white-space: nowrap;">{% raw %}`${{ runner.os }}`{% endraw %}</span>. For example, the following workflow could be run successfully if you changed the operating system from `macos-latest` to `windows-latest` without having to alter the syntax of the environment variables, which differs depending on the shell being used by the runner.
{% raw %}
```yaml
jobs:
weekday_job:
runs-on: ubuntu-latest
env:
DAY_OF_WEEK: Mon
if-Windows-else:
runs-on: macos-latest
steps:
- name: "Hello world when it's Monday"
if: ${{ env.DAY_OF_WEEK == 'Mon' }}
run: echo "Hello $FIRST_NAME $middle_name $Last_Name, today is Monday!"
env:
FIRST_NAME: Mona
middle_name: The
Last_Name: Octocat
- name: condition 1
if: runner.os == 'Windows'
run: echo "The operating system on the runner is $env:RUNNER_OS."
- name: condition 2
if: runner.os != 'Windows'
run: echo "The operating system on the runner is not Windows, it's $RUNNER_OS."
```
{% endraw %}
要在工作流程文件中使用环境变量的值,您应该使用 [`env` 上下文](/actions/reference/context-and-expression-syntax-for-github-actions#env-context)。 如果要在运行器中使用环境变量的值,您可以使用运行器操作系统的正常方法来读取环境变量。
In this example, the two `if` statements check the `os` property of the `runner` context to determine the operating system of the runner. `if` conditionals are processed by {% data variables.product.prodname_actions %}, and only steps where the check resolves as `true` are sent to the runner. Here one of the checks will always be `true` and the other `false`, so only one of these steps is sent to the runner. Once the job is sent to the runner, the step is executed and the environment variable in the `echo` command is interpolated using the appropriate syntax (`$env:NAME` for PowerShell on Windows, and `$NAME` for bash and sh on Linux and MacOS). In this example, the statement `runs-on: macos-latest` means that the second step will be run.
如果使用工作流程文件的 `run` 键从运行器操作系统中读取环境变量(如上例所示),则在作业发送到运行器后,该变量将在运行器操作系统中被替换。 对于工作流程文件的其他部分,必须使用 `env` 上下文来读取环境变量;这是因为工作流程键(例如 `if`)需要在发送到运行器之前,在工作流程处理过程中替换变量。
## Passing values between steps and jobs in a workflow
You can also use the `GITHUB_ENV` environment file to set an environment variable that the following steps in a job can use. The environment file can be used directly by an action or as a shell command in a workflow file using the `run` keyword. 更多信息请参阅“[{% data variables.product.prodname_actions %} 的工作流程命令](/actions/reference/workflow-commands-for-github-actions/#setting-an-environment-variable)”。
If you generate a value in one step of a job, you can use the value in subsequent steps of the same job by assigning the value to an existing or new environment variable and then writing this to the `GITHUB_ENV` environment file. The environment file can be used directly by an action, or from a shell command in the workflow file by using the `run` keyword. 更多信息请参阅“[{% data variables.product.prodname_actions %} 的工作流程命令](/actions/reference/workflow-commands-for-github-actions/#setting-an-environment-variable)”。
## 默认环境变量
强烈建议操作使用环境变量访问文件系统,而非使用硬编码的文件路径。 {% data variables.product.prodname_dotcom %} 设置供操作用于所有运行器环境中的环境变量。
| 环境变量 | 描述 |
| -------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `CI` | 始终设置为 `true`。 |
| `GITHUB_WORKFLOW` | 工作流程的名称。 |
| `GITHUB_RUN_ID` | {% data reusables.github-actions.run_id_description %}
| `GITHUB_RUN_NUMBER` | {% data reusables.github-actions.run_number_description %}
| `GITHUB_JOB` | 当前作业的 [job_id](/actions/reference/workflow-syntax-for-github-actions#jobsjob_id)。 |
| `GITHUB_ACTION` | 操作唯一的标识符 (`id`)。 |
| `GITHUB_ACTION_PATH` | 您的操作所在的路径。 您可以使用此路径访问与操作位于同一仓库中的文件。 此变量仅在复合操作中才受支持。 |
| `GITHUB_ACTIONS` | 当 {% data variables.product.prodname_actions %} 运行工作流程时,始终设置为 `true`。 您可以使用此变量来区分测试是在本地运行还是通过 {% data variables.product.prodname_actions %} 运行。 |
| `GITHUB_ACTOR` | 发起工作流程的个人或应用程序的名称。 例如 `octocat`。 |
| `GITHUB_REPOSITORY` | 所有者和仓库名称。 例如 `octocat/Hello-World`。 |
| `GITHUB_EVENT_NAME` | 触发工作流程的 web 挂钩事件的名称。 |
| `GITHUB_EVENT_PATH` | 具有完整 web 挂钩事件有效负载的文件路径。 例如 `/github/workflow/event.json`。 |
| `GITHUB_WORKSPACE` | {% data variables.product.prodname_dotcom %} 工作空间目录路径,初始为空白。 例如 `/home/runner/work/my-repo-name/my-repo-name`。 [actions/checkout](https://github.com/actions/checkout) 操作将在此目录内检出文件,默认情况下是仓库的副本。 |
| `GITHUB_SHA` | 触发工作流程的提交 SHA。 例如 `ffac537e6cbbf934b08745a378932722df287a53`。 |
| `GITHUB_REF` | 触发工作流程的分支或标记参考。 例如 `refs/heads/feature-branch-1`。 如果分支或标记都不适用于事件类型,则变量不会存在。 |
{%- ifversion fpt or ghec or ghes > 3.3 or ghae-issue-5338 %}
| `GITHUB_REF_NAME` | {% data reusables.actions.ref_name-description %} | | `GITHUB_REF_PROTECTED` | {% data reusables.actions.ref_protected-description %} | | `GITHUB_REF_TYPE` | {% data reusables.actions.ref_type-description %}
{%- endif %}
| `GITHUB_HEAD_REF` | Only set for pull request events. 头部分支的名称。 | `GITHUB_BASE_REF` | Only set for pull request events. 基础分支的名称。 | `GITHUB_SERVER_URL`| Returns the URL of the {% data variables.product.product_name %} server. 例如: `https://{% data variables.product.product_url %}`。 | `GITHUB_API_URL` | Returns the API URL. 例如: `{% data variables.product.api_url_code %}`。 | `GITHUB_GRAPHQL_URL` | Returns the GraphQL API URL. 例如: `{% data variables.product.graphql_url_code %}`。 | `RUNNER_NAME` | {% data reusables.actions.runner-name-description %} | `RUNNER_OS` | {% data reusables.actions.runner-os-description %}{% if actions-runner-arch-envvars %} | `RUNNER_ARCH` | {% data reusables.actions.runner-arch-description %}{% endif %} | `RUNNER_TEMP` | {% data reusables.actions.runner-temp-directory-description %}
{% ifversion not ghae %}| `RUNNER_TOOL_CACHE` | {% data reusables.actions.runner-tool-cache-description %}{% endif %}
{% tip %}
**注:**如果需要在作业中使用工作流程运行的 URL您可以组合这些环境变量`$GITHUB_SERVER_URL/$GITHUB_REPOSITORY/actions/runs/$GITHUB_RUN_ID`
{% endtip %}
### 确定何时使用默认环境变量或上下文
{% data reusables.github-actions.using-context-or-environment-variables %}
## 环境变量命名约定
设置自定义环境变量时,不能使用上面列出的前缀为 `GITHUB_` 的任何默认环境变量名称。 如果尝试重写其中一个默认环境变量的值,则会忽略赋值。
您设置的指向文件系统上某个位置的任何新环境变量都应该有 `_PATH` 后缀。 `HOME``GITHUB_WORKSPACE` 默认变量例外于此约定,因为 "home" 和 "workspace" 一词已经暗示位置。
If you want to pass a value from a step in one job in a workflow to a step in another job in the workflow, you can define the value as a job output. You can then reference this job output from a step in another job. 更多信息请参阅“[{% data variables.product.prodname_actions %} 的工作流程语法](/actions/learn-github-actions/workflow-syntax-for-github-actions#jobsjob_idoutputs)”。

View File

@@ -15,7 +15,7 @@ miniTocMaxHeadingLevel: 3
## About expressions
您可以使用表达式程序化设置工作流程文件中的变量和访问上下文。 表达式可以是文字值、上下文引用或函数的任意组合。 您可以使用运算符组合文字、上下文引用和函数。 For more information about contexts, see "[Contexts](/actions/learn-github-actions/contexts)."
You can use expressions to programmatically set environment variables in workflow files and access contexts. 表达式可以是文字值、上下文引用或函数的任意组合。 您可以使用运算符组合文字、上下文引用和函数。 For more information about contexts, see "[Contexts](/actions/learn-github-actions/contexts)."
表达式通常在工作流程文件中与条件性 `if` 关键词一起用来确定步骤是否应该运行。 当 `if` 条件为 `true` 时,步骤将会运行。
@@ -50,16 +50,17 @@ env:
作为表达式的一部分,您可以使用 `boolean``null``number``string` 数据类型。
| 数据类型 | 文字值 |
| -------- | ---------------------- |
| `布尔值` | `true``false` |
| `null` | `null` |
| `number` | JSON 支持的任何数字格式。 |
| `字符串` | 必须使用单引号。 使用单引号逸出文字单引号。 |
| 数据类型 | 文字值 |
| -------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `布尔值` | `true``false` |
| `null` | `null` |
| `number` | JSON 支持的任何数字格式。 |
| `字符串` | You don't need to enclose strings in {% raw %}${{{% endraw %} and {% raw %}}}{% endraw %}. However, if you do, you must use single quotes around the string and escape literal single quotes with an additional single quote. |
#### 示例
{% raw %}
```yaml
env:
myNull: ${{ null }}
@@ -68,27 +69,28 @@ env:
myFloatNumber: ${{ -9.2 }}
myHexNumber: ${{ 0xff }}
myExponentialNumber: ${{ -2.99-e2 }}
myString: ${{ 'Mona the Octocat' }}
myEscapedString: ${{ 'It''s open source!' }}
myString: Mona the Octocat
myStringInBraces: ${{ 'It''s open source!' }}
```
{% endraw %}
## 运算符
| 运算符 | 描述 |
| ------------------------- | ------ |
| `( )` | 逻辑分组 |
| `[ ]` | 索引 |
| `.` | 属性解除参考 |
| `!` | 非 |
| `<` | 小于 |
| `<=` | 小于或等于 |
| `>` | 大于 |
| `>=` | 大于或等于 |
| `==` | 等于 |
| `!=` | 不等于 |
| `&&` | 和 |
| <code>\|\|</code> | 或 |
| 运算符 | 描述 |
| ------------------------- | --------------------- |
| `( )` | 逻辑分组 |
| `[ ]` | 索引 |
| `.` | Property de-reference |
| `!` | 非 |
| `<` | 小于 |
| `<=` | 小于或等于 |
| `>` | 大于 |
| `>=` | 大于或等于 |
| `==` | 等于 |
| `!=` | 不等于 |
| `&&` | 和 |
| <code>\|\|</code> | 或 |
{% data variables.product.prodname_dotcom %} 进行宽松的等式比较。
@@ -252,7 +254,7 @@ jobs:
返回匹配 `path` 模式的文件集的单个哈希值。 您可以提供单一 `path` 模式,或以逗号分隔的多个 `path` 模式。 `path` 相对于 `GITHUB_WORKSPACE` 目录,只能包括 `GITHUB_WORKSPACE` 中的文件。 此函数为每个匹配的文件计算单独的 SHA-256 哈希, 然后使用这些哈希来计算文件集的最终 SHA-256 哈希。 有关 SHA-256 的更多信息,请参阅“[SHA-2](https://en.wikipedia.org/wiki/SHA-2)”。
您可以使用模式匹配字符来匹配文件名。 模式匹配在 Windows 上不区分大小写。 有关支持的模式匹配字符的更多信息,请参阅“[{% data variables.product.prodname_actions %} 的工作流程语法](/github/automating-your-workflow-with-github-actions/workflow-syntax-for-github-actions/#filter-pattern-cheat-sheet)”。
您可以使用模式匹配字符来匹配文件名。 模式匹配在 Windows 上不区分大小写。 有关支持的模式匹配字符的更多信息,请参阅“[{% data variables.product.prodname_actions %} 的工作流程语法](/actions/using-workflows/workflow-syntax-for-github-actions/#filter-pattern-cheat-sheet)”。
#### 单一模式示例

View File

@@ -137,3 +137,7 @@ jobs:
1. 使用或创建具有该仓库适当权限的令牌。 更多信息请参阅“[创建个人访问令牌](/github/authenticating-to-github/creating-a-personal-access-token)”。
1. 添加令牌作为工作流程仓库中的密码,然后使用 {%raw%}`${{ secrets.SECRET_NAME }}`{% endraw %} 语法进行引用。 更多信息请参阅“[创建和使用加密密码](/github/automating-your-workflow-with-github-actions/creating-and-using-encrypted-secrets)”。
### 延伸阅读
- "[Resources in the REST API](/rest/overview/resources-in-the-rest-api#rate-limiting)"

View File

@@ -5,7 +5,7 @@ intro: Modify the default permissions granted to `GITHUB_TOKEN`.
versions:
fpt: '*'
ghes: '> 3.1'
ghae: ghae-next
ghae: '*'
ghec: '*'
miniTocMaxHeadingLevel: 4
---

View File

@@ -5,7 +5,7 @@ intro: Run a single job at a time.
versions:
fpt: '*'
ghes: '> 3.1'
ghae: ghae-next
ghae: '*'
ghec: '*'
miniTocMaxHeadingLevel: 4
---

View File

@@ -1397,6 +1397,61 @@ on: workflow_dispatch
您可以直接在工作流程中配置事件的自定义输入属性、默认输入值和必要输入。 When you trigger the event, you can provide the `ref` and any `inputs`. 当工作流程运行时,您可以访问 `github.event.inputs` 上下文中的输入值。 更多信息请参阅“[上下文](/actions/learn-github-actions/contexts)”。
{% ifversion fpt or ghec or ghes > 3.3 or ghae-issue-5511 %}
This example defines inputs called `logLevel`, `tags`, and `environment`. You pass values for these inputs to the workflow when you run it. This workflow then prints the values to the log, using the `github.event.inputs.logLevel`, `github.event.inputs.tags`, and `github.event.inputs.environment` context properties.
{% raw %}
```yaml
on:
workflow_dispatch:
inputs:
logLevel:
description: 'Log level'
required: true
default: 'warning'
type: choice
options:
- info
- warning
- debug
tags:
description: 'Test scenario tags'
required: false
type: boolean
environment:
description: 'Environment to run tests against'
type: environment
required: true
jobs:
log-the-inputs:
runs-on: ubuntu-latest
steps:
- run: |
echo "Log level: $LEVEL"
echo "Tags: $TAGS"
echo "Environment: $ENVIRONMENT"
env:
LEVEL: ${{ github.event.inputs.logLevel }}
TAGS: ${{ github.event.inputs.tags }}
ENVIRONMENT: ${{ github.event.inputs.environment }}
```
{% endraw %}
If you run this workflow from a browser you must enter values for the required inputs manually before the workflow will run.
![Entering inputs for a workflow](/assets/images/help/images/workflow-dispatch-inputs.png)
You can also pass inputs when you run a workflow from a script, or by using {% data variables.product.prodname_cli %}. 例如:
```
gh workflow run run-tests.yml -f logLevel=warning -f tags=false -f environment=staging
```
For more information, see the {% data variables.product.prodname_cli %} information in "[Manually running a workflow](/actions/managing-workflow-runs/manually-running-a-workflow)."
{% else %}
此示例定义了 `name` 和 `home` 输入,并使用 `github.event.inputs.name` 和 `github.event.inputs.home` 上下文打印。 如果未提供 `home` 则打印默认值“The Octoverse”。
```yaml
@@ -1424,6 +1479,7 @@ jobs:
NAME: {% raw %}${{ github.event.inputs.name }}{% endraw %}
HOME: {% raw %}${{ github.event.inputs.home }}{% endraw %}
```
{% endif %}
### `workflow_run`
@@ -1492,7 +1548,7 @@ jobs:
#### Limiting your workflow to run based on branches
You can use the `branches` or `branches-ignore` filter to specify what branches the triggering workflow must run on in order to trigger your workflow. 更多信息请参阅“[GitHub Actions 的工作流程语法](/actions/learn-github-actions/workflow-syntax-for-github-actions#onworkflow_runbranchesbranches-ignore)”。 For example, a workflow with the following trigger will only run when the workflow named `Build` runs on a branch named `canary`.
You can use the `branches` or `branches-ignore` filter to specify what branches the triggering workflow must run on in order to trigger your workflow. For more information, see "[Workflow syntax for GitHub Actions](/actions/learn-github-actions/workflow-syntax-for-github-actions#onworkflow_runbranchesbranches-ignore)." For example, a workflow with the following trigger will only run when the workflow named `Build` runs on a branch named `canary`.
```yaml
on:

View File

@@ -164,9 +164,9 @@ You call a reusable workflow by using the `uses` keyword. Unlike when you are us
[`jobs.<job_id>.uses`](/actions/reference/workflow-syntax-for-github-actions#jobsjob_iduses)
You reference reusable workflow files using the syntax:
You reference reusable workflow files using {% ifversion fpt or ghec or ghes > 3.4 or ghae-issue-6000 %}one of the following syntaxes:{% else %}the syntax:{% endif %}
`{owner}/{repo}/{path}/{filename}@{ref}`
{% data reusables.actions.reusable-workflow-calling-syntax %}
You can call multiple workflows, referencing each in a separate job.

View File

@@ -308,7 +308,7 @@ console.log('::save-state name=processID::12345')
console.log("The running PID from the main action is: " + process.env.STATE_processID);
```
## 环境文件
## Environment files
在工作流程执行期间,运行器生成可用于执行某些操作的临时文件。 这些文件的路径通过环境变量显示。 写入这些文件时,您需要使用 UTF-8 编码,以确保正确处理命令。 多个命令可以写入同一个文件,用换行符分隔。
@@ -347,16 +347,10 @@ More detail about UTF-8 and PowerShell Core found on this great [Stack Overflow
## 设置环境变量
``` bash
echo "{name}={value}" >> $GITHUB_ENV
echo "{environment_variable_name}={value}" >> $GITHUB_ENV
```
为作业中接下来运行的任何步骤创建或更新环境变量。 创建或更新环境变量的步骤无法访问新值,但在作业中的所有后续步骤均可访问。 环境变量区分大小写,并且可以包含标点符号
{% note %}
**Note:** Environment variables must be explicitly referenced using the [`env` context](/actions/reference/context-and-expression-syntax-for-github-actions#env-context) in expression syntax or through use of the `$GITHUB_ENV` file directly; environment variables are not implicitly available in shell commands.
{% endnote %}
You can make an environment variable available to any subsequent steps in a workflow job by defining or updating the environment variable and writing this to the `GITHUB_ENV` environment file. 创建或更新环境变量的步骤无法访问新值,但在作业中的所有后续步骤均可访问。 The names of environment variables are case-sensitive, and you can include punctuation. 更多信息请参阅“[环境变量](/actions/learn-github-actions/environment-variables)”
### 示例

View File

@@ -183,7 +183,7 @@ on:
logLevel:
description: 'Log level'
required: true
default: 'warning' {% ifversion ghec or ghes > 3.3 or ghae-issue-5511 %}
default: 'warning' {% ifversion fpt or ghec or ghes > 3.3 or ghae-issue-5511 %}
type: choice
options:
- info
@@ -191,7 +191,7 @@ on:
- debug {% endif %}
tags:
description: 'Test scenario tags'
required: false {% ifversion ghec or ghes > 3.3 or ghae-issue-5511 %}
required: false {% ifversion fpt or ghec or ghes > 3.3 or ghae-issue-5511 %}
type: boolean
environment:
description: 'Environment to run tests against'
@@ -209,7 +209,7 @@ jobs:
{% ifversion fpt or ghes > 3.1 or ghae or ghec %}
## `permissions`
## `权限`
{% data reusables.actions.jobs.section-assigning-permissions-to-jobs %}
@@ -914,11 +914,9 @@ volumes:
{% ifversion fpt or ghes > 3.3 or ghae-issue-4757 or ghec %}
## `jobs.<job_id>.uses`
The location and version of a reusable workflow file to run as a job.
The location and version of a reusable workflow file to run as a job. {% ifversion fpt or ghec or ghes > 3.4 or ghae-issue-6000 %}Use one of the following syntaxes:{% endif %}
`{owner}/{repo}/{path}/{filename}@{ref}`
`{ref}` can be a SHA, a release tag, or a branch name. Using the commit SHA is the safest for stability and security. For more information, see "[Security hardening for GitHub Actions](/actions/learn-github-actions/security-hardening-for-github-actions#reusing-third-party-workflows)."
{% data reusables.actions.reusable-workflow-calling-syntax %}
### 示例

View File

@@ -20,7 +20,7 @@ topics:
## About {% data variables.product.prodname_secret_scanning %}
{% data reusables.secret-scanning.about-secret-scanning %} For more information, see "[About {% data variables.product.prodname_secret_scanning %}](/github/administering-a-repository/about-secret-scanning)."
If someone checks a secret with a known pattern into a repository, {% data variables.product.prodname_secret_scanning %} catches the secret as it's checked in, and helps you mitigate the impact of the leak. Repository administrators are notified about any commit that contains a secret, and they can quickly view all detected secrets in the Security tab for the repository. For more information, see "[About {% data variables.product.prodname_secret_scanning %}](/code-security/secret-scanning/about-secret-scanning)."
## Checking whether your license includes {% data variables.product.prodname_GH_advanced_security %}

View File

@@ -32,6 +32,8 @@ You can always reach the {% data variables.enterprise.management_console %} usin
To access the {% data variables.enterprise.management_console %}, you must use the administrator password established during initial setup of {% data variables.product.product_location %}. You must also be able to connect to the virtual machine host on port 8443. If you're having trouble reaching the {% data variables.enterprise.management_console %}, please check intermediate firewall and security group configurations.
The {% data variables.enterprise.management_console %} password hash is stored in `/data/user/common/secrets.conf`, and that file is automatically synced from the primary appliance to any high-availability replicas. Any change to the primary's password will automatically be replicated to high-availability replicas. For more information about high availability, see "[About high availability configuration](/admin/enterprise-management/configuring-high-availability/about-high-availability-configuration)."
## Accessing the {% data variables.enterprise.management_console %} as a site administrator
The first time that you access the {% data variables.enterprise.management_console %} as a site administrator, you must upload your {% data variables.product.prodname_enterprise %} license file to authenticate into the app. For more information, see "[Managing your license for {% data variables.product.prodname_enterprise %}](/billing/managing-your-license-for-github-enterprise)."

View File

@@ -667,6 +667,32 @@ You can add the optional `--prune` argument to remove unreachable Git objects th
ghe-repo-gc <em>username</em>/<em>reponame</em>
```
## {% data variables.product.prodname_actions %}
### ghe-actions-check
This utility checks that all services for {% data variables.product.prodname_actions %} are healthy. For more information, see "[Getting started with {% data variables.product.prodname_actions %} for {% data variables.product.product_name %}](/admin/github-actions/getting-started-with-github-actions-for-your-enterprise/getting-started-with-github-actions-for-github-enterprise-server)" and "[Troubleshooting {% data variables.product.prodname_actions %} for your enterprise](/admin/github-actions/advanced-configuration-and-troubleshooting/troubleshooting-github-actions-for-your-enterprise)."
```shell
ghe-actions-check
```
### ghe-actions-precheck
This utility tests the blob storage configuration for {% data variables.product.prodname_actions %} on {% data variables.product.product_location %}. You can use the utility to verify your storage configuration before you enable {% data variables.product.prodname_actions %} for your instance.
For more information about the configuration of {% data variables.product.prodname_actions %}, see "[Getting started with {% data variables.product.prodname_actions %} for {% data variables.product.product_name %}](/admin/github-actions/getting-started-with-github-actions-for-your-enterprise/getting-started-with-github-actions-for-github-enterprise-server)."
```shell
ghe-actions-precheck -p [<em>provider</em>] -cs ["<em>connectionstring</em>"]
```
If your storage system is configured correctly, you'll see the following output.
```
All Storage tests passed
```
## Import and export
### ghe-migrator
@@ -836,7 +862,7 @@ This utility will enforce the default organization membership visibility setting
ghe-org-membership-update --visibility=<em>SETTING</em>
```
### ghe-user-csv
### `ghe-user-csv`
This utility exports a list of all the users in the installation into CSV format. The CSV file includes the email address, which type of user they are (e.g., admin, user), how many repositories they have, how many SSH keys, how many organization memberships, last logged IP address, etc. Use the `-h` flag for more options.

View File

@@ -15,10 +15,11 @@ topics:
shortTitle: 关于 HA 配置
---
配置高可用性时会自动设置将所有数据存储Git 仓库、MySQL、Redis 和 Elasticsearch单向、异步地从主设备复制到副本。
配置高可用性时会自动设置将所有数据存储Git 仓库、MySQL、Redis 和 Elasticsearch单向、异步地从主设备复制到副本。 Most {% data variables.product.prodname_ghe_server %} configuration settings are also replicated, including the {% data variables.enterprise.management_console %} password. For more information, see "[Accessing the management console](/admin/configuration/configuring-your-enterprise/accessing-the-management-console)."
{% data variables.product.prodname_ghe_server %} 支持主动/被动配置,在这些配置下,副本作为备用设备运行,并且数据库服务在复制模式下运行,但应用程序服务将停止。
After replication has been established, the {% data variables.enterprise.management_console %} is no longer accessible on replica appliances. If you navigate to the replica's IP address or hostname on port 8443, you'll see a "Server in replication mode" message, which indicates that the appliance is currently configured as a replica.
{% data reusables.enterprise_installation.replica-limit %}
## 有针对性的故障场景
@@ -44,13 +45,13 @@ shortTitle: 关于 HA 配置
在故障转移期间,必须将主设备置于维护模式,并将其 DNS 记录重定向到副本的 IP 地址。 将流量从主设备重新定向到副本所需的时间将取决于 TTL 配置以及更新 DNS 记录所需的时间。
如果您要使用 Geo-replication则必须配置 Geo DNS将流量定向到距离最近的副本。 更多信息请参阅“[关于 Geo-replication](/enterprise/{{ currentVersion }}/admin/guides/installation/about-geo-replication/)”。
如果您要使用 Geo-replication则必须配置 Geo DNS将流量定向到距离最近的副本。 For more information, see "[About geo-replication](/enterprise/{{ currentVersion }}/admin/guides/installation/about-geo-replication/)."
### 负载均衡器
{% data reusables.enterprise_clustering.load_balancer_intro %} {% data reusables.enterprise_clustering.load_balancer_dns %}
在故障转移期间,您必须将主设备置于维护模式。 您可以将负载均衡器配置为自动检测副本何时已升级为主设备,或者可能需要手动更改配置。 您必须先将副本手动升级为主设备,随后副本才能对用户流量作出响应。 更多信息请参阅“[结合使用 {% data variables.product.prodname_ghe_server %} 和负载均衡器](/enterprise/{{ currentVersion }}/admin/guides/installation/using-github-enterprise-server-with-a-load-balancer/)”。
在故障转移期间,您必须将主设备置于维护模式。 您可以将负载均衡器配置为自动检测副本何时已升级为主设备,或者可能需要手动更改配置。 您必须先将副本手动升级为主设备,随后副本才能对用户流量作出响应。 For more information, see "[Using {% data variables.product.prodname_ghe_server %} with a load balancer](/enterprise/{{ currentVersion }}/admin/guides/installation/using-github-enterprise-server-with-a-load-balancer/)."
{% data reusables.enterprise_installation.monitoring-replicas %}

View File

@@ -58,7 +58,7 @@ It's not possible to add CPU or memory resources to an existing AWS/EC2 instance
{% note %}
**Note:** To add CPU or memory resources in Microsoft Azure, you must be familiar with using either the Azure Portal, Azure CLI or Azure Powershell to manage VM instances. For background and details on using the Azure tools of your choice to perform the resize, please refer to the Azure documentation on [changing the size of a virtual machine](https://docs.microsoft.com/en-us/azure/virtual-machines/resize-vm).
**Note:** To add CPU or memory resources in Microsoft Azure, you must be familiar with using either the Azure Portal, Azure CLI or Azure PowerShell to manage VM instances. For background and details on using the Azure tools of your choice to perform the resize, please refer to the Azure documentation on [changing the size of a virtual machine](https://docs.microsoft.com/en-us/azure/virtual-machines/resize-vm).
{% endnote %}

View File

@@ -40,7 +40,8 @@ topics:
- {% data reusables.enterprise_installation.hotpatching-explanation %}
- A hotpatch may require downtime if the affected services (like kernel, MySQL, or Elasticsearch) require a VM reboot or a service restart. You'll be notified when a reboot or restart is required. You can complete the reboot or restart at a later time.
- Additional root storage must be available when upgrading through hotpatching, as it installs multiple versions of certain services until the upgrade is complete. Pre-flight checks will notify you if you don't have enough root disk storage.
- When upgrading through hotpatching, your instance cannot be too heavily loaded, as it may impact the hotpatching process. Pre-flight checks will consider the load average and the upgrade will fail if the load average is too high.- Upgrading to {% data variables.product.prodname_ghe_server %} 2.17 migrates your audit logs from Elasticsearch to MySQL. This migration also increases the amount of time and disk space it takes to restore a snapshot. Before migrating, check the number of bytes in your Elasticsearch audit log indices with this command:
- When upgrading through hotpatching, your instance cannot be too heavily loaded, as it may impact the hotpatching process.
- Upgrading to {% data variables.product.prodname_ghe_server %} 2.17 migrates your audit logs from Elasticsearch to MySQL. This migration also increases the amount of time and disk space it takes to restore a snapshot. Before migrating, check the number of bytes in your Elasticsearch audit log indices with this command:
``` shell
curl -s http://localhost:9201/audit_log/_stats/store | jq ._all.primaries.store.size_in_bytes
```

View File

@@ -41,7 +41,9 @@ shortTitle: 升级 GHES
## 生成快照
快照是虚拟机 (VM) 在某一时间点的检查点。 强烈建议在升级虚拟机之前生成快照,这样一来,如果升级失败,您可以将 VM 还原到快照状态。 如果您要升级到新的功能版本,则必须生成 VM 快照。 如果您要升级到补丁版本,可以连接现有数据磁盘。
快照是虚拟机 (VM) 在某一时间点的检查点。 强烈建议在升级虚拟机之前生成快照,这样一来,如果升级失败,您可以将 VM 还原到快照状态。 We only recommend taking a VM snapshot when the appliance is powered down or in maintenance mode and all background jobs have finished.
如果您要升级到新的功能版本,则必须生成 VM 快照。 如果您要升级到补丁版本,可以连接现有数据磁盘。
有两种类型的快照:
@@ -67,7 +69,9 @@ shortTitle: 升级 GHES
## 使用热补丁升级
{% data reusables.enterprise_installation.hotpatching-explanation %} 利用 {% data variables.enterprise.management_console %},您可以立即安装热补丁,也可以排定稍后安装热补丁。 您可以使用管理 shell 的 `ghe-upgrade` 实用程序安装热补丁。 更多信息请参阅“[升级要求](/enterprise/{{ currentVersion }}/admin/guides/installation/upgrade-requirements/)”。
{% data reusables.enterprise_installation.hotpatching-explanation %}
Using the {% data variables.enterprise.management_console %}, you can install a hotpatch immediately or schedule it for later installation. 您可以使用管理 shell 的 `ghe-upgrade` 实用程序安装热补丁。 更多信息请参阅“[升级要求](/enterprise/{{ currentVersion }}/admin/guides/installation/upgrade-requirements/)”。
{% note %}
@@ -84,6 +88,10 @@ shortTitle: 升级 GHES
#### 使用 {% data variables.enterprise.management_console %} 安装热补丁
You can use the {% data variables.enterprise.management_console %} to upgrade with a hotpatch by enabling automatic updates. You will then be presented with the latest available version of {% data variables.product.prodname_ghe_server %} that you can upgrade to.
If the upgrade target you're presented with is a feature release instead of a patch release, you cannot use the {% data variables.enterprise.management_console %} to install a hotpatch. You must install the hotpatch using the administrative shell instead. For more information, see "[Installing a hotpatch using the administrative shell](#installing-a-hotpatch-using-the-administrative-shell)."
1. 启用自动更新。 更多信息请参阅“[启用自动更新](/enterprise/{{ currentVersion }}/admin/guides/installation/enabling-automatic-update-checks/)”。
{% data reusables.enterprise_site_admin_settings.access-settings %}
{% data reusables.enterprise_site_admin_settings.management-console %}

View File

@@ -13,6 +13,11 @@ redirect_from:
- /admin/github-actions/troubleshooting-github-actions-for-your-enterprise
shortTitle: Troubleshoot GitHub Actions
---
## Checking the health of {% data variables.product.prodname_actions %}
You can check the health of {% data variables.product.prodname_actions %} on {% data variables.product.product_location %} with the `ghe-actions-check` command-line utility. For more information, see "[Command-line utilities](/admin/configuration/configuring-your-enterprise/command-line-utilities#ghe-actions-check)" and "[Accessing the administrative shell (SSH)](/admin/configuration/configuring-your-enterprise/accessing-the-administrative-shell-ssh)."
## Configuring self-hosted runners when using a self-signed certificate for {% data variables.product.prodname_ghe_server %}
{% data reusables.actions.enterprise-self-signed-cert %} For more information, see "[Configuring TLS](/admin/configuration/configuring-tls)."
@@ -177,4 +182,4 @@ There are three ways to resolve this problem:
```
1. Return to {% data variables.product.prodname_ghe_server %}.
{% endif %}
{% endif %}

View File

@@ -26,6 +26,8 @@ Before enabling {% data variables.product.prodname_actions %}, make sure you hav
## Enabling {% data variables.product.prodname_actions %} with Amazon S3 storage
{% data reusables.enterprise_installation.ssh-into-instance %}
{% data reusables.actions.perform-blob-storage-precheck %}
{% data reusables.enterprise_site_admin_settings.access-settings %}
{% data reusables.enterprise_site_admin_settings.management-console %}
{% data reusables.enterprise_management_console.actions %}

View File

@@ -33,6 +33,8 @@ Before enabling {% data variables.product.prodname_actions %}, make sure you hav
## Enabling {% data variables.product.prodname_actions %} with Azure Blob storage
{% data reusables.enterprise_installation.ssh-into-instance %}
{% data reusables.actions.perform-blob-storage-precheck %}
{% data reusables.enterprise_site_admin_settings.access-settings %}
{% data reusables.enterprise_site_admin_settings.management-console %}
{% data reusables.enterprise_management_console.actions %}

View File

@@ -27,6 +27,8 @@ Before enabling {% data variables.product.prodname_actions %}, make sure you hav
## Enabling {% data variables.product.prodname_actions %} with MinIO Gateway for NAS storage
{% data reusables.enterprise_installation.ssh-into-instance %}
{% data reusables.actions.perform-blob-storage-precheck %}
{% data reusables.enterprise_site_admin_settings.access-settings %}
{% data reusables.enterprise_site_admin_settings.management-console %}
{% data reusables.enterprise_management_console.actions %}

View File

@@ -113,6 +113,8 @@ To enable {% data variables.product.prodname_actions %} on {% data variables.pro
{% endnote %}
Before you enable {% data variables.product.prodname_actions %}, you can test your storage configuration from the administrative shell with the `ghe-actions-precheck` utility. For more information, see "[Command-line utilities](/admin/configuration/configuring-your-enterprise/command-line-utilities#ghe-actions-check)" and "[Accessing the administrative shell (SSH)](/admin/configuration/configuring-your-enterprise/accessing-the-administrative-shell-ssh)."
## Networking considerations
{% data reusables.actions.proxy-considerations %} For more information about using a proxy with {% data variables.product.prodname_ghe_server %}, see "[Configuring an outbound web proxy server](/admin/configuration/configuring-network-settings/configuring-an-outbound-web-proxy-server)."

View File

@@ -16,8 +16,6 @@ type: how_to
shortTitle: Configure SAML with Okta
---
{% data reusables.enterprise-accounts.user-provisioning-release-stage %}
{% data reusables.enterprise-accounts.emu-saml-note %}
## 关于使用 Octa 的 SAML
@@ -28,25 +26,20 @@ SAML SSO 控制并保护对企业帐户资源(如组织、仓库、议题和
{% data reusables.saml.switching-from-org-to-enterprise %} For more information, see "[Switching your SAML configuration from an organization to an enterprise account](/github/setting-up-and-managing-your-enterprise/configuring-identity-and-access-management-for-your-enterprise-account/switching-your-saml-configuration-from-an-organization-to-an-enterprise-account)."
## 基本要求
{% data reusables.saml.use-classic-ui %}
Alternatively, you can also configure SAML SSO using Okta for an organization that uses {% data variables.product.prodname_ghe_cloud %}. 更多信息请参阅“[使用 Okta 配置 SAML 单点登录和 SCIM](/organizations/managing-saml-single-sign-on-for-your-organization/configuring-saml-single-sign-on-and-scim-using-okta)”。
## 在 Okta 中添加 {% data variables.product.prodname_ghe_cloud %} 应用程序
{% data reusables.saml.okta-admin-button %}
{% data reusables.saml.okta-sign-into-your-account %}
1. Navigate to the [Github Enterprise Cloud - Enterprise Accounts](https://www.okta.com/integrations/github-enterprise-cloud-enterprise-accounts) application in the Okta Integration Network and click **Add Integration**.
{% data reusables.saml.okta-dashboard-click-applications %}
{% data reusables.saml.add-okta-application %}
{% data reusables.saml.search-ghec-okta %}
1. 单击“{% data variables.product.prodname_ghe_cloud %} - Enterprise Accounts企业帐户”。
1. 单击 **Add添加**
1. 可选在“Application label应用程序标签”右边输入应用程序的描述性名称。 ![应用程序标签字段](/assets/images/help/saml/okta-application-label.png)
1. 在“{% data variables.product.prodname_dotcom %} Enterprises”右侧键入企业帐户的名称。 例如,如果企业帐户的 URL 是`https://github.com/enterprises/octo-corp`,请键入 `octo-corp`。 ![GitHub Enterprises 字段](/assets/images/help/saml/okta-github-enterprises.png)
1. 可选在“Application label应用程序标签”右边输入应用程序的描述性名称。
1. 在“{% data variables.product.prodname_dotcom %} Enterprises”右侧键入企业帐户的名称。 例如,如果企业帐户的 URL 是`https://github.com/enterprises/octo-corp`,请键入 `octo-corp`
1. 单击 **Done完成**
## 启用和测试 SAML SSO
{% data reusables.saml.okta-admin-button %}
{% data reusables.saml.okta-sign-into-your-account %}
{% data reusables.saml.okta-dashboard-click-applications %}
{% data reusables.saml.click-enterprise-account-application %}
{% data reusables.saml.assign-yourself-to-okta %}
@@ -63,14 +56,3 @@ SAML SSO 控制并保护对企业帐户资源(如组织、仓库、议题和
1. 在 Okta 中,创建一个组来匹配企业帐户拥有的每个组织。 每个组的名称必须与组织的帐户名称匹配(而不是组织的显示名称)。 例如,如果组织的 URL 为`https://github.com/octo-org`,则将组命名为 `octo-org`
1. 将为企业帐户创建的应用程序分配给每个组。 {% data variables.product.prodname_dotcom %} 将接收每个用户的所有`组`数据。
1. 根据您希望用户所属的组织将用户添加到组。
## 启用 SAML 用户预配
{% data reusables.enterprise-accounts.access-enterprise %}
{% data reusables.enterprise-accounts.settings-tab %}
{% data reusables.enterprise-accounts.security-tab %}
1. 在“SAML User ProvisioningSAML 用户预配)”下,选择 **Enable SAML user provisioning启用 SAML 用户预配)**。 ![使用 SAML 启用用户预配的复选框](/assets/images/help/business-accounts/user-provisioning.png)
1. 单击 **Save保存**
1. (可选)启用 SAML 用户解除预配。
- 选择 **Enable SAML user deprovisioning启用 SAML 用户解除预配)**,然后单击 **Save保存**。 ![使用 SAML 启用用户解除预配的复选框](/assets/images/help/business-accounts/saml-deprovisioning.png)
- 阅读警告,然后单击 **Enable SAML deprovisioning启用 SAML 解除预配)**。 ![启用 SAML 解除预配按钮](/assets/images/help/business-accounts/saml-deprovisioning-confirm.png)

View File

@@ -42,9 +42,11 @@ shortTitle: 内部仓库迁移
1. 连接到管理 shell。 更多信息请参阅“[访问管理 shell (SSH)](/enterprise/admin/installation/accessing-the-administrative-shell-ssh)。”
{% ifversion ghes or ghae %}
2. 运行迁移命令。
```shell
github-env bin/safe-ruby lib/github/transitions/20191210220630_convert_public_ghes_repos_to_internal.rb --verbose -w | tee -a /tmp/convert_public_ghes_repos_to_internal.log
```
{% else %}
2. 导航至 `/data/github/current` 目录。
```shell

View File

@@ -18,6 +18,10 @@ shortTitle: 关于 2FA
{% data reusables.two_fa.after-2fa-add-security-key %}
{% ifversion fpt or ghec %}
In addition to security keys, you can also use {% data variables.product.prodname_mobile %} for 2FA after configuring a TOTP mobile app or text messages. {% data variables.product.prodname_mobile %} uses public-key cryptography to secure your account, allowing you to use any mobile device that you've used to signed in to {% data variables.product.prodname_mobile %} as your second factor.
{% endif %}
您还可以配置其他恢复方法,以防无法访问双重身份验证凭据。 有关设置 2FA 的更多信息,请参阅“[配置双重身份验证](/articles/configuring-two-factor-authentication)”和“[配置双重身份验证恢复方法](/articles/configuring-two-factor-authentication-recovery-methods)”。
为确保帐户安全,**强烈**建议启用 2FA不仅在 {% data variables.product.product_name %} 上启用,在支持 2FA 的其他网站和应用程序上也要启用。 您可以启用 2FA 以访问 {% data variables.product.product_name %} 和 {% data variables.product.prodname_desktop %}。

View File

@@ -37,6 +37,24 @@ shortTitle: 使用 2FA 访问 GitHub
如果设置通过短信进行双重身份验证,{% data variables.product.product_name %} 将通过短信向您发送验证码。
### Verifying with {% data variables.product.prodname_mobile %}
If you have installed and signed in to {% data variables.product.prodname_mobile %}, you may choose to authenticate with {% data variables.product.prodname_mobile %} for two-factor authentication.
1. Sign in to {% data variables.product.product_name %} with your browser, using your username and password.
2. If you have added a security key to your account, you'll first be prompted to insert and use a security key. To skip using a security key, click **Authenticate with {% data variables.product.prodname_mobile %}**. ![Two-factor authentication challenge on {% data variables.product.product_name %} with "Authenticate with {% data variables.product.prodname_mobile %}" highlighted](/assets/images/help/2fa/2fa-select-mobile.png)
3. {% data variables.product.product_name %} will send you a push notification to verify your sign in attempt. Opening the push notification or opening the {% data variables.product.prodname_mobile %} app will display a prompt, asking you to approve or reject this sign in attempt.
{% note %}
**Note**: This prompt may require you to enter a two-digit number displayed within the browser you are signing in to.
{% endnote %}
![Two-factor authentication challenge with {% data variables.product.prodname_mobile %} requiring a two-digit input](/assets/images/help/2fa/2fa-mobile-number-challenge.png)
- Upon approving the login attempt using {% data variables.product.prodname_mobile %}, your browser will complete the sign in attempt automatically.
- Rejecting the sign in attempt will prevent the authentication from finishing. For more information, see "[Keeping your account and data secure](/authentication/keeping-your-account-and-data-secure)."
{% endif %}
## 通过命令行使用双重身份验证

View File

@@ -123,6 +123,20 @@ If you're a member of an {% data variables.product.prodname_emu_enterprise %}, y
9. 确认您已下载并且能够访问恢复代码。 如果尚未下载,或者要生成另一组代码,请下载代码并将其保存在安全位置。 如果无法访问自己的帐户,您可以使用恢复代码来恢复帐户访问。 更多信息请参阅“[丢失 2FA 凭据时恢复帐户](/articles/recovering-your-account-if-you-lose-your-2fa-credentials)”。 ![下载恢复代码按钮](/assets/images/help/2fa/2fa-recover-during-setup.png)
{% data reusables.two_fa.test_2fa_immediately %}
{% ifversion fpt or ghec %}
## Configuring two-factor authentication using {% data variables.product.prodname_mobile %}
You can use {% data variables.product.prodname_mobile %} for 2FA when signing into your {% data variables.product.prodname_dotcom %} account in a web browser. 2FA with {% data variables.product.prodname_mobile %} does not rely on TOTP, and instead uses public-key cryptography to secure your account.
Once you have configured a TOTP application, or SMS, you can also use {% data variables.product.prodname_mobile %} to authenticate. If, in the future, you no longer have access to {% data variables.product.prodname_mobile %}, you will still be able to use security keys or TOTP applications to sign in.
1. You must have already configured 2FA via a TOTP mobile app or via SMS.
2. Install [{% data variables.product.prodname_mobile %}](https://github.com/mobile).
3. Sign in to your {% data variables.product.product_name %} account from {% data variables.product.prodname_mobile %}.
After signing in, you can now use your device for 2FA.
{% endif %}
## 延伸阅读
- "[关于双重身份验证](/articles/about-two-factor-authentication)"

View File

@@ -139,13 +139,15 @@ Replace the `autobuild` step with the same build commands you would use in produ
For more information, see "[Configuring the {% data variables.product.prodname_codeql %} workflow for compiled languages](/code-security/secure-coding/configuring-the-codeql-workflow-for-compiled-languages#adding-build-steps-for-a-compiled-language)."
### Inspect the copy of the source files in the {% data variables.product.prodname_codeql %} database
You may be able to understand why some source files haven't been analyzed by inspecting the copy of the source code included with the {% data variables.product.prodname_codeql %} database. To obtain the database from your Actions workflow, add an `upload-artifact` action after the analysis step in your code scanning workflow:
You may be able to understand why some source files haven't been analyzed by inspecting the copy of the source code included with the {% data variables.product.prodname_codeql %} database. To obtain the database from your Actions workflow, modify the `init` step of your {% data variables.product.prodname_codeql %} workflow file and set `debug: true`.
```yaml
- uses: actions/upload-artifact@v2
- name: Initialize CodeQL
uses: github/codeql-action/init@v1
with:
name: {% raw %}codeql-database-${{ matrix.language }}{% endraw %}
path: {% raw %}${{ runner.temp }}/codeql_databases{% endraw %}
debug: true
```
This uploads the database as an actions artifact that you can download to your local machine. For more information, see "[Storing workflow artifacts](/actions/guides/storing-workflow-data-as-artifacts)."
The artifact will contain an archived copy of the source files scanned by {% data variables.product.prodname_codeql %} called _src.zip_. If you compare the source code files in the repository and the files in _src.zip_, you can see which types of file are missing. Once you know what types of file are not being analyzed, it is easier to understand how you may need to change the workflow for {% data variables.product.prodname_codeql %} analysis.

View File

@@ -71,24 +71,24 @@ After you extract the {% data variables.product.prodname_codeql_cli %} bundle, y
**Extract from successful output:**
```
codeql-cpp (/<extraction-root>/codeql/qlpacks/codeql-cpp)
codeql-cpp-examples (/<extraction-root>/codeql/qlpacks/codeql-cpp-examples)
codeql-cpp-upgrades (/<extraction-root>/codeql/qlpacks/codeql-cpp-upgrades)
codeql-csharp (/<extraction-root>/codeql/qlpacks/codeql-csharp)
codeql-csharp-examples (/<extraction-root>/codeql/qlpacks/codeql-csharp-examples)
codeql-csharp-upgrades (/<extraction-root>/codeql/qlpacks/codeql-csharp-upgrades)
codeql-go (/<extraction-root>/codeql/qlpacks/codeql-go)
codeql-go-examples (/<extraction-root>/codeql/qlpacks/codeql-go-examples)
codeql-go-upgrades (/<extraction-root>/codeql/qlpacks/codeql-go-upgrades)
codeql-java (/<extraction-root>/codeql/qlpacks/codeql-java)
codeql-java-examples (/<extraction-root>/codeql/qlpacks/codeql-java-examples)
codeql-java-upgrades (/<extraction-root>/codeql/qlpacks/codeql-java-upgrades)
codeql-javascript (/<extraction-root>/codeql/qlpacks/codeql-javascript)
codeql-javascript-examples (/<extraction-root>/codeql/qlpacks/codeql-javascript-examples)
codeql-javascript-upgrades (/<extraction-root>/codeql/qlpacks/codeql-javascript-upgrades)
codeql-python (/<extraction-root>/codeql/qlpacks/codeql-python)
codeql-python-examples (/<extraction-root>/codeql/qlpacks/codeql-python-examples)
codeql-python-upgrades (/<extraction-root>/codeql/qlpacks/codeql-python-upgrades)
codeql/cpp-all (/<extraction-root>/qlpacks/codeql/cpp-all/<version>)
codeql/cpp-examples (/<extraction-root>/qlpacks/codeql/cpp-examples/<version>)
codeql/cpp-queries (/<extraction-root>/qlpacks/codeql/cpp-queries/<version>)
codeql/csharp-all (/<extraction-root>/qlpacks/codeql/charp-all/<version>)
codeql/csharp-examples (/<extraction-root>/qlpacks/codeql/charp-examples/<version>)
codeql/csharp-queries (/<extraction-root>/qlpacks/codeql/charp-queries/<version>)
codeql/java-all (/<extraction-root>/qlpacks/codeql/java-all/<version>)
codeql/java-examples (/<extraction-root>/qlpacks/codeql/java-examples/<version>)
codeql/java-queries (/<extraction-root>/qlpacks/codeql/java-queries/<version>)
codeql/javascript-all (/<extraction-root>/qlpacks/codeql/javascript-all/<version>)
codeql/javascript-examples (/<extraction-root>/qlpacks/codeql/javascript-examples/<version>)
codeql/javascript-queries (/<extraction-root>/qlpacks/codeql/javascript-queries/<version>)
codeql/python-all (/<extraction-root>/qlpacks/codeql/python-all/<version>)
codeql/python-examples (/<extraction-root>/qlpacks/codeql/python-examples/<version>)
codeql/python-queries (/<extraction-root>/qlpacks/codeql/python-queries/<version>)
codeql/ruby-all (/<extraction-root>/qlpacks/codeql/ruby-all/<version>)
codeql/ruby-examples (/<extraction-root>/qlpacks/codeql/ruby-examples/<version>)
codeql/ruby-queries (/<extraction-root>/qlpacks/codeql/ruby-queries/<version>)
...
```

View File

@@ -23,27 +23,29 @@ includeGuides:
- /code-security/getting-started/github-security-features
- /code-security/getting-started/securing-your-organization
- /code-security/getting-started/securing-your-repository
- /code-security/secret-security/about-secret-scanning
- /code-security/secret-security/configuring-secret-scanning-for-your-repositories
- /code-security/secret-security/managing-alerts-from-secret-scanning
- /code-security/code-scanning//automatically-scanning-your-code-for-vulnerabilities-and-errors/tracking-code-scanning-alerts-in-issues-using-task-lists
- /code-security/secure-coding/automatically-scanning-your-code-for-vulnerabilities-and-errors/about-code-scanning
- /code-security/secure-coding/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning
- /code-security/secure-coding/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-the-codeql-workflow-for-compiled-languages
- /code-security/secure-coding/automatically-scanning-your-code-for-vulnerabilities-and-errors/managing-code-scanning-alerts-for-your-repository
- /code-security/secure-coding/automatically-scanning-your-code-for-vulnerabilities-and-errors/running-codeql-code-scanning-in-a-container
- /code-security/secure-coding/automatically-scanning-your-code-for-vulnerabilities-and-errors/setting-up-code-scanning-for-a-repository
- /code-security/secure-coding/automatically-scanning-your-code-for-vulnerabilities-and-errors/triaging-code-scanning-alerts-in-pull-requests
- /code-security/secure-coding/automatically-scanning-your-code-for-vulnerabilities-and-errors/troubleshooting-the-codeql-workflow
- /code-security/secure-coding/integrating-with-code-scanning/about-integration-with-code-scanning
- /code-security/secure-coding/integrating-with-code-scanning/sarif-support-for-code-scanning
- /code-security/secure-coding/integrating-with-code-scanning/uploading-a-sarif-file-to-github
- /code-security/secure-coding/using-codeql-code-scanning-with-your-existing-ci-system/about-codeql-code-scanning-in-your-ci-system
- /code-security/secure-coding/using-codeql-code-scanning-with-your-existing-ci-system/configuring-codeql-cli-in-your-ci-system
- /code-security/secure-coding/using-codeql-code-scanning-with-your-existing-ci-system/configuring-codeql-runner-in-your-ci-system
- /code-security/secure-coding/using-codeql-code-scanning-with-your-existing-ci-system/installing-codeql-cli-in-your-ci-system
- /code-security/secure-coding/using-codeql-code-scanning-with-your-existing-ci-system/running-codeql-runner-in-your-ci-system
- /code-security/secure-coding/using-codeql-code-scanning-with-your-existing-ci-system/troubleshooting-codeql-runner-in-your-ci-system
- /code-security/secret-scanning/about-secret-scanning
- /code-security/secret-scanning/configuring-secret-scanning-for-your-repositories
- /code-security/secret-scanning/defining-custom-patterns-for-secret-scanning
- /code-security/secret-scanning/managing-alerts-from-secret-scanning
- /code-security/secret-scanning/secret-scanning-partners
- /code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/tracking-code-scanning-alerts-in-issues-using-task-lists
- /code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/about-code-scanning
- /code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning
- /code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-the-codeql-workflow-for-compiled-languages
- /code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/managing-code-scanning-alerts-for-your-repository
- /code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/running-codeql-code-scanning-in-a-container
- /code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/setting-up-code-scanning-for-a-repository
- /code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/triaging-code-scanning-alerts-in-pull-requests
- /code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/troubleshooting-the-codeql-workflow
- /code-security/code-scanning/integrating-with-code-scanning/about-integration-with-code-scanning
- /code-security/code-scanning/integrating-with-code-scanning/sarif-support-for-code-scanning
- /code-security/code-scanning/integrating-with-code-scanning/uploading-a-sarif-file-to-github
- /code-security/code-scanning/using-codeql-code-scanning-with-your-existing-ci-system/about-codeql-code-scanning-in-your-ci-system
- /code-security/code-scanning/using-codeql-code-scanning-with-your-existing-ci-system/configuring-codeql-cli-in-your-ci-system
- /code-security/code-scanning/using-codeql-code-scanning-with-your-existing-ci-system/configuring-codeql-runner-in-your-ci-system
- /code-security/code-scanning/using-codeql-code-scanning-with-your-existing-ci-system/installing-codeql-cli-in-your-ci-system
- /code-security/code-scanning/using-codeql-code-scanning-with-your-existing-ci-system/running-codeql-runner-in-your-ci-system
- /code-security/code-scanning/using-codeql-code-scanning-with-your-existing-ci-system/troubleshooting-codeql-runner-in-your-ci-system
- /code-security/security-advisories/about-coordinated-disclosure-of-security-vulnerabilities
- /code-security/security-advisories/about-github-security-advisories
- /code-security/security-advisories/adding-a-collaborator-to-a-security-advisory

View File

@@ -2,7 +2,6 @@
title: About secret scanning
intro: '{% data variables.product.product_name %} scans repositories for known types of secrets, to prevent fraudulent use of secrets that were committed accidentally.'
product: '{% data reusables.gated-features.secret-scanning %}'
miniTocMaxHeadingLevel: 3
redirect_from:
- /github/administering-a-repository/about-token-scanning
- /articles/about-token-scanning
@@ -23,75 +22,78 @@ topics:
{% data reusables.secret-scanning.beta %}
{% data reusables.secret-scanning.enterprise-enable-secret-scanning %}
## About {% data variables.product.prodname_secret_scanning %}
If your project communicates with an external service, you might use a token or private key for authentication. Tokens and private keys are examples of secrets that a service provider can issue. If you check a secret into a repository, anyone who has read access to the repository can use the secret to access the external service with your privileges. We recommend that you store secrets in a dedicated, secure location outside of the repository for your project.
{% data variables.product.prodname_secret_scanning_caps %} will scan your entire Git history on all branches present in your {% data variables.product.prodname_dotcom %} repository for any secrets. Service providers can partner with {% data variables.product.company_short %} to provide their secret formats for scanning.{% ifversion fpt or ghec %} For more information, see "[Secret scanning partner program](/developers/overview/secret-scanning-partner-program)."
{% endif %}
{% data variables.product.prodname_secret_scanning_caps %} will scan your entire Git history on all branches present in your {% data variables.product.prodname_dotcom %} repository for any secrets. Service providers can partner with {% data variables.product.company_short %} to provide their secret formats for scanning. For details of the supported secrets and service providers, see "[{% data variables.product.prodname_secret_scanning_caps %} partners](/code-security/secret-scanning/secret-scanning-partners)."
{% data reusables.secret-scanning.about-secret-scanning %}
{% data reusables.secret-scanning.partner-program-link %}
{% ifversion fpt or ghec %}
## About {% data variables.product.prodname_secret_scanning %} for public repositories
{% data variables.product.prodname_secret_scanning_caps %} is automatically enabled on public repositories. When you push to a public repository, {% data variables.product.product_name %} scans the content of the commits for secrets. If you switch a private repository to public, {% data variables.product.product_name %} scans the entire repository for secrets.
{% data variables.product.prodname_secret_scanning_caps %} is automatically enabled on public repositories. When you push to a public repository, {% data variables.product.product_name %} scans the content of the commits for secrets.
When {% data variables.product.prodname_secret_scanning %} detects a set of credentials, we notify the service provider who issued the secret. The service provider validates the credential and then decides whether they should revoke the secret, issue a new secret, or reach out to you directly, which will depend on the associated risks to you or the service provider. For an overview of how we work with token-issuing partners, see "[Secret scanning partner program](/developers/overview/secret-scanning-partner-program)."
When {% data variables.product.prodname_secret_scanning %} detects a potential secret, we notify the service provider who issued the secret. The service provider validates the string and then decides whether they should revoke the secret, issue a new secret, or contact you directly. Their action will depend on the associated risks to you or them.
### List of supported secrets for public repositories
You cannot change the configuration of {% data variables.product.prodname_secret_scanning %} on public repositories.
{% data variables.product.product_name %} currently scans public repositories for secrets issued by the following service providers.
{% data reusables.secret-scanning.partner-secret-list-public-repo %}
## About {% data variables.product.prodname_secret_scanning %} for private repositories
{% ifversion fpt %}
Organizations using {% data variables.product.prodname_ghe_cloud %} with {% data variables.product.prodname_GH_advanced_security %} can configure {% data variables.product.prodname_secret_scanning %} to run on private repositories. For more information, see the [{% data variables.product.prodname_ghe_cloud %} documentation](/enterprise-cloud@latest/code-security/secret-security/about-secret-scanning).
{% endif %}
{% ifversion ghes or ghae %}
{% endif %}
{% ifversion not fpt %}
{% ifversion ghec %}
## About {% data variables.product.prodname_secret_scanning %} for private repositories
{% elsif ghes or ghae %}
## About {% data variables.product.prodname_secret_scanning %} on {% data variables.product.product_name %}
{% data variables.product.prodname_secret_scanning_caps %} is available on all organization-owned repositories as part of {% data variables.product.prodname_GH_advanced_security %}. It is not available on user-owned repositories.
{% endif %}
If you're a repository administrator or an organization owner, you can enable {% data variables.product.prodname_secret_scanning %} for {% ifversion fpt or ghec %} private{% endif %} repositories that are owned by organizations. You can enable {% data variables.product.prodname_secret_scanning %} for all your repositories, or for all new repositories within your organization.{% ifversion fpt or ghec %} {% data variables.product.prodname_secret_scanning_caps %} is not available for user-owned private repositories.{% endif %} For more information, see "[Managing security and analysis settings for your repository](/github/administering-a-repository/managing-security-and-analysis-settings-for-your-repository)" and "[Managing security and analysis settings for your organization](/organizations/keeping-your-organization-secure/managing-security-and-analysis-settings-for-your-organization)."
If you're a repository administrator or an organization owner, you can enable {% data variables.product.prodname_secret_scanning %} for {% ifversion ghec %} private{% endif %} repositories that are owned by organizations. You can enable {% data variables.product.prodname_secret_scanning %} for all your organization's repositories, or for all new repositories within your organization.{% ifversion ghec %} {% data variables.product.prodname_secret_scanning_caps %} is not available for private repositories owned by user accounts.{% endif %} For more information, see "[Managing security and analysis settings for your repository](/github/administering-a-repository/managing-security-and-analysis-settings-for-your-repository)" and "[Managing security and analysis settings for your organization](/organizations/keeping-your-organization-secure/managing-security-and-analysis-settings-for-your-organization)."
{% ifversion fpt or ghes > 3.1 or ghae or ghec %}You can also define custom {% data variables.product.prodname_secret_scanning %} patterns that only apply to your repository or organization. For more information, see "[Defining custom patterns for {% data variables.product.prodname_secret_scanning %}](/code-security/secret-security/defining-custom-patterns-for-secret-scanning)."{% endif %}
{% ifversion ghes > 3.1 or ghae or ghec %}You can also define custom {% data variables.product.prodname_secret_scanning %} patterns for a repository, organization, or enterprise. For more information, see "[Defining custom patterns for {% data variables.product.prodname_secret_scanning %}](/code-security/secret-security/defining-custom-patterns-for-secret-scanning)."
{% elsif ghes < 3.2 %}
Versions 3.1 and lower of {% data variables.product.product_name %} do not allow you to define your own patterns for detecting secrets.
{% endif %}
When you push commits to a{% ifversion fpt or ghec %} private{% endif %} repository with {% data variables.product.prodname_secret_scanning %} enabled, {% data variables.product.prodname_dotcom %} scans the contents of the commits for secrets.
### About {% data variables.product.prodname_secret_scanning %} alerts
When {% data variables.product.prodname_secret_scanning %} detects a secret in a{% ifversion fpt or ghec %} private{% endif %} repository, {% data variables.product.prodname_dotcom %} generates an alert.
When you push commits to a{% ifversion ghec %} private{% endif %} repository with {% data variables.product.prodname_secret_scanning %} enabled, {% data variables.product.prodname_dotcom %} scans the contents of the commits for secrets.
When {% data variables.product.prodname_secret_scanning %} detects a secret in a{% ifversion ghec %} private{% endif %} repository, {% data variables.product.prodname_dotcom %} generates an alert.
- {% data variables.product.prodname_dotcom %} sends an email alert to the repository administrators and organization owners.
{% ifversion fpt or ghes > 3.0 or ghae or ghec %}
{% ifversion ghes > 3.0 or ghae or ghec %}
- {% data variables.product.prodname_dotcom %} sends an email alert to the contributor who committed the secret to the repository, with a link to the related {% data variables.product.prodname_secret_scanning %} alert. The commit author can then view the alert in the repository, and resolve the alert.
{% endif %}
- {% data variables.product.prodname_dotcom %} displays an alert in the repository.{% ifversion ghes = 3.0 %} For more information, see "[Managing alerts from {% data variables.product.prodname_secret_scanning %}](/github/administering-a-repository/managing-alerts-from-secret-scanning)."{% endif %}
{% ifversion fpt or ghes > 3.0 or ghae or ghec %}
{% ifversion ghes > 3.0 or ghae or ghec %}
For more information about viewing and resolving {% data variables.product.prodname_secret_scanning %} alerts, see "[Managing alerts from {% data variables.product.prodname_secret_scanning %}](/github/administering-a-repository/managing-alerts-from-secret-scanning)."{% endif %}
Repository administrators and organization owners can grant users and teams access to {% data variables.product.prodname_secret_scanning %} alerts. For more information, see "[Managing security and analysis settings for your repository](/github/administering-a-repository/managing-security-and-analysis-settings-for-your-repository#granting-access-to-security-alerts)."
{% ifversion fpt or ghes > 3.0 or ghec %}
To monitor results from {% data variables.product.prodname_secret_scanning %} across your {% ifversion fpt or ghec %}private {% endif %}repositories{% ifversion ghes > 3.1 %} or your organization{% endif %}, you can use the {% data variables.product.prodname_secret_scanning %} API. For more information about API endpoints, see "[{% data variables.product.prodname_secret_scanning_caps %}](/rest/reference/secret-scanning)."{% endif %}
{% ifversion ghes or ghae %}
## List of supported secrets{% else %}
### List of supported secrets for private repositories
{% ifversion ghec or ghes > 3.1 %}
You can use the security overview to see an organization-level view of which repositories have enabled {% data variables.product.prodname_secret_scanning %} and the alerts found. For more information, see "[Viewing the security overview](/code-security/security-overview/viewing-the-security-overview)."
{% endif %}
{% data variables.product.prodname_dotcom %} currently scans{% ifversion fpt or ghec %} private{% endif %} repositories for secrets issued by the following service providers.
{%- ifversion ghec or ghes > 3.1 %}You can also use the REST API to {% elsif ghes = 3.1 %}You can use the REST API to {% endif %}
{%- ifversion ghec or ghes > 3.0 %}monitor results from {% data variables.product.prodname_secret_scanning %} across your {% ifversion ghec %}private {% endif %}repositories{% ifversion ghes > 3.1 %} or your organization{% endif %}. For more information about API endpoints, see "[{% data variables.product.prodname_secret_scanning_caps %}](/rest/reference/secret-scanning)."{% endif %}
{% data reusables.secret-scanning.partner-secret-list-private-repo %}
{% ifversion ghes < 3.2 or ghae %}
{% note %}
**Note:** {% data variables.product.prodname_secret_scanning_caps %} does not currently allow you to define your own patterns for detecting secrets.
{% endnote %}
{% endif %}
## Further reading
- "[Securing your repository](/code-security/getting-started/securing-your-repository)"
- "[Keeping your account and data secure](/github/authenticating-to-github/keeping-your-account-and-data-secure)"
{%- ifversion fpt or ghec %}
- "[Managing encrypted secrets for your codespaces](/codespaces/managing-your-codespaces/managing-encrypted-secrets-for-your-codespaces)"{% endif %}
{%- ifversion fpt or ghec or ghes > 3.2 %}
- "[Managing encrypted secrets for Dependabot](/code-security/supply-chain-security/keeping-your-dependencies-updated-automatically/managing-encrypted-secrets-for-dependabot)"{% endif %}
- "[Encrypted secrets](/actions/security-guides/encrypted-secrets)"

View File

@@ -8,7 +8,6 @@ redirect_from:
- /code-security/secret-security/configuring-secret-scanning-for-your-repositories
product: '{% data reusables.gated-features.secret-scanning %}'
versions:
fpt: '*'
ghes: '*'
ghae: '*'
ghec: '*'

View File

@@ -6,12 +6,13 @@ product: '{% data reusables.gated-features.secret-scanning %}'
redirect_from:
- /code-security/secret-security/defining-custom-patterns-for-secret-scanning
versions:
fpt: '*'
ghes: '>=3.2'
ghae: '*'
ghec: '*'
type: how_to
topics:
- Repositories
- Advanced Security
- Secret scanning
---
{% ifversion ghes < 3.3 or ghae %}
@@ -24,7 +25,7 @@ topics:
## About custom patterns for {% data variables.product.prodname_secret_scanning %}
{% data variables.product.company_short %} performs {% data variables.product.prodname_secret_scanning %} on {% ifversion fpt or ghec %}public and private{% endif %} repositories for secret patterns provided by {% data variables.product.company_short %} and {% data variables.product.company_short %} partners. For more information on the {% data variables.product.prodname_secret_scanning %} partner program, see "<a href="/developers/overview/secret-scanning-partner-program" class="dotcom-only">Secret scanning partner program</a>."
{% data variables.product.company_short %} performs {% data variables.product.prodname_secret_scanning %} on {% ifversion fpt or ghec %}public and private{% endif %} repositories for secret patterns provided by {% data variables.product.company_short %} and {% data variables.product.company_short %} partners. {% data reusables.secret-scanning.partner-program-link %} For details of the supported secrets and service providers, see "[{% data variables.product.prodname_secret_scanning_caps %} partners](/code-security/secret-scanning/secret-scanning-partners)."
However, there can be situations where you want to scan for other secret patterns in your {% ifversion fpt or ghec %}private{% endif %} repositories. For example, you might have a secret pattern that is internal to your organization. For these situations, you can define custom {% data variables.product.prodname_secret_scanning %} patterns in your enterprise, organization, or {% ifversion fpt or ghec %}private{% endif %} repository on {% data variables.product.product_name %}. You can define up to
{%- ifversion fpt or ghec or ghes > 3.3 %} 500 custom patterns for each organization or enterprise account, and up to 100 custom patterns per {% ifversion fpt or ghec %}private{% endif %} repository.
@@ -46,7 +47,16 @@ However, there can be situations where you want to scan for other secret pattern
## Regular expression syntax for custom patterns
Custom patterns for {% data variables.product.prodname_secret_scanning %} are specified as regular expressions. {% data variables.product.prodname_secret_scanning_caps %} uses the [Hyperscan library](https://github.com/intel/hyperscan) and only supports Hyperscan regex constructs, which are a subset of PCRE syntax. Hyperscan option modifiers are not supported. For more information on Hyperscan pattern constructs, see "[Pattern support](http://intel.github.io/hyperscan/dev-reference/compilation.html#pattern-support)" in the Hyperscan documentation.
Custom patterns for {% data variables.product.prodname_secret_scanning %} are specified as one or more regular expressions.
- **Secret format:** an expression that describes the format of the secret itself.
- **Before secret:** an expression that describes the characters that come before the secret. By default, this is set to `\A|[^0-9A-Za-z]` which means that the secret must be at the start of a line or be preceded by a non-alphanumeric character.
- **After secret:** an expression that describes the characters that come after the secret. By default, this is set to `\z|[^0-9A-Za-z]` which means that the secret must be followed by a new line or a non-alphanumeric character.
- **Additional match requirements:** one or more optional expressions that the secret itself must or must not match.
For simple tokens you will usually only need to specify a secret format. The other fields provide flexibility so that you can specify more complex secrets without creating complex regular expressions. For an example of a custom pattern, see "[Example of a custom pattern specified using additional requirements](#example-of-a-custom-pattern-specified-using-additional-requirements)" below.
{% data variables.product.prodname_secret_scanning_caps %} uses the [Hyperscan library](https://github.com/intel/hyperscan) and only supports Hyperscan regex constructs, which are a subset of PCRE syntax. Hyperscan option modifiers are not supported. For more information on Hyperscan pattern constructs, see "[Pattern support](http://intel.github.io/hyperscan/dev-reference/compilation.html#pattern-support)" in the Hyperscan documentation.
## Defining a custom pattern for a repository
@@ -61,6 +71,35 @@ Before defining a custom pattern, you must ensure that {% data variables.product
After your pattern is created, {% data reusables.secret-scanning.secret-scanning-process %} For more information on viewing {% data variables.product.prodname_secret_scanning %} alerts, see "[Managing alerts from {% data variables.product.prodname_secret_scanning %}](/code-security/secret-security/managing-alerts-from-secret-scanning)."
### Example of a custom pattern specified using additional requirements
A company has an internal token with five characteristics. They use the different fields to specify how to identify tokens as follows:
| **Characteristic** | **Field and regular expression** |
|----------------|------------------------------|
| Length between 5 and 10 characters | Secret format: `[$#%@AA-Za-z0-9]{5,10}` |
| Does not end in a `.` | After secret: `[^\.]` |
| Contains numbers and uppercase letters | Additional requirements: secret must match `[A-Z]` and `[0-9]` |
| Does not include more than one lowercase letter in a row | Additional requirements: secret must not match `[a-z]{2,}` |
| Contains one of `$%@!` | Additional requirements: secret must match `[$%@!]` |
These tokens would match the custom pattern described above:
```
a9@AAfT! # Secret string match: a9@AAfT
ee95GG@ZA942@aa # Secret string match: @ZA942@a
a9@AA!ee9 # Secret string match: a9@AA
```
These strings would not match the custom pattern described above:
```
a9@AA.!
a@AAAAA
aa9@AA!ee9
aAAAe9
```
## Defining a custom pattern for an organization
Before defining a custom pattern, you must ensure that you enable {% data variables.product.prodname_secret_scanning %} for the {% ifversion fpt or ghec %}private{% endif %} repositories that you want to scan in your organization. To enable {% data variables.product.prodname_secret_scanning %} on all {% ifversion fpt or ghec %}private{% endif %} repositories in your organization, see "[Managing security and analysis settings for your organization](/organizations/keeping-your-organization-secure/managing-security-and-analysis-settings-for-your-organization)."

View File

@@ -19,5 +19,6 @@ children:
- /configuring-secret-scanning-for-your-repositories
- /defining-custom-patterns-for-secret-scanning
- /managing-alerts-from-secret-scanning
- /secret-scanning-partners
---

View File

@@ -6,7 +6,6 @@ redirect_from:
- /github/administering-a-repository/managing-alerts-from-secret-scanning
- /code-security/secret-security/managing-alerts-from-secret-scanning
versions:
fpt: '*'
ghes: '*'
ghae: '*'
ghec: '*'

View File

@@ -0,0 +1,55 @@
---
title: Secret scanning partners
intro: 'Lists of supported secrets and the partners that {% data variables.product.company_short %} works with to prevent fraudulent use of secrets that were committed accidentally.'
product: '{% data reusables.gated-features.secret-scanning %}'
versions:
fpt: '*'
ghes: '*'
ghae: '*'
ghec: '*'
type: reference
topics:
- Secret scanning
- Advanced Security
---
{% data reusables.secret-scanning.beta %}
{% data reusables.secret-scanning.enterprise-enable-secret-scanning %}
{% ifversion fpt or ghec %}
## List of supported secrets for public repositories
{% data variables.product.product_name %} 当前会扫描公共仓库,查找以下服务提供商发布的密码。
{% data reusables.secret-scanning.partner-secret-list-public-repo %}
{% endif %}
{% ifversion fpt %}
Organizations using {% data variables.product.prodname_ghe_cloud %} with {% data variables.product.prodname_GH_advanced_security %} can run {% data variables.product.prodname_secret_scanning %} on private repositories. For more information, see the [{% data variables.product.prodname_ghe_cloud %} documentation](/enterprise-cloud@latest/code-security/secret-scanning/secret-scanning-partners).
{% endif %}
{% ifversion ghec or ghae or ghes %}
## List of supported secrets {% ifversion ghec %}for private repositories{% endif %}
{% ifversion ghes > 3.1 or ghae or ghec %}
{% note %}
**Note:** You can also define custom {% data variables.product.prodname_secret_scanning %} patterns that only apply to your repository or organization. For more information, see "[Defining custom patterns for {% data variables.product.prodname_secret_scanning %}](/code-security/secret-security/defining-custom-patterns-for-secret-scanning)."
{% endnote %}
{% endif %}
{% data variables.product.prodname_dotcom %} 目前扫描{% ifversion ghec %}私有{% endif %}仓库,以检查由以下服务提供者颁发的密码。
{% data reusables.secret-scanning.partner-secret-list-private-repo %}
{% endif %}
## 延伸阅读
- "[保护您的仓库](/code-security/getting-started/securing-your-repository)"
- "[保护帐户和数据安全](/github/authenticating-to-github/keeping-your-account-and-data-secure)"
{%- ifversion fpt or ghec %}
- "[{% data variables.product.prodname_secret_scanning_caps %} partner program](/developers/overview/secret-scanning-partner-program)"
{%- else %}
- "[{% data variables.product.prodname_secret_scanning_caps %} partner program](/free-pro-team@latest/developers/overview/secret-scanning-partner-program)" in the {% data variables.product.prodname_ghe_cloud %} documentation
{% endif %}

View File

@@ -121,15 +121,16 @@ Available in the code scanning alert views. All code scanning alerts have one of
Available in the secret scanning alert views.
| 限定符 | 描述 |
| ------------------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `secret-type:SERVICE_PROVIDER` | Displays alerts for the specified secret and provider. For more information, see "[List of supported secrets for private repositories](/code-security/secret-scanning/about-secret-scanning#list-of-supported-secrets-for-private-repositories) |
| `secret-type:CUSTOM-PATTERN` | Displays alerts for secrets matching the specified custom pattern. For more information, see "[Defining custom patterns for secret scanning](/code-security/secret-scanning/defining-custom-patterns-for-secret-scanning)." |
| 限定符 | 描述 |
| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `secret-type:SERVICE_PROVIDER` | Displays alerts for the specified secret and provider. For more information, see "[{% data variables.product.prodname_secret_scanning_caps %} partners](/code-security/secret-scanning/secret-scanning-partners) |
| `secret-type:CUSTOM-PATTERN` | Displays alerts for secrets matching the specified custom pattern. |
| {% ifversion not fpt %}For more information, see "[Defining custom patterns for secret scanning](/code-security/secret-scanning/defining-custom-patterns-for-secret-scanning)."{% endif %} | |
## Filter by provider
Available in the secret scanning alert views.
| 限定符 | 描述 |
| ------------------------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `provider:PROVIDER_NAME` | Displays alerts for all secrets issues by the specified provider. For more information, see "[List of supported secrets for private repositories](/code-security/secret-scanning/about-secret-scanning#list-of-supported-secrets-for-private-repositories) |
| 限定符 | 描述 |
| ------------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `provider:PROVIDER_NAME` | Displays alerts for all secrets issues by the specified provider. For more information, see "[{% data variables.product.prodname_secret_scanning_caps %} partners](/code-security/secret-scanning/secret-scanning-partners) |

View File

@@ -64,7 +64,7 @@ You can also enable or disable {% data variables.product.prodname_dependabot_ale
For information about access requirements for actions related to {% data variables.product.prodname_dependabot_alerts %}, see "[Repository roles for an organization](/organizations/managing-access-to-your-organizations-repositories/repository-roles-for-an-organization#access-requirements-for-security-features)."
{% data variables.product.product_name %} starts generating the dependency graph immediately and generates alerts for any vulnerable dependencies as soon as they are identified. The graph is usually populated within minutes but this may take longer for repositories with many dependencies. For more information, see "[Managing data use settings for your private repository](/github/understanding-how-github-uses-and-protects-your-data/managing-data-use-settings-for-your-private-repository)."
{% data variables.product.product_name %} starts generating the dependency graph immediately and generates alerts for any vulnerable dependencies as soon as they are identified. The graph is usually populated within minutes but this may take longer for repositories with many dependencies. For more information, see "[Managing data use settings for your private repository](/get-started/privacy-on-github/managing-data-use-settings-for-your-private-repository)."
{% endif %}
When {% data variables.product.product_name %} identifies a vulnerable dependency, we generate a {% data variables.product.prodname_dependabot %} alert and display it {% ifversion fpt or ghec or ghes > 3.0 %} on the Security tab for the repository and{% endif %} in the repository's dependency graph. The alert includes {% ifversion fpt or ghec or ghes > 3.0 %}a link to the affected file in the project, and {% endif %}information about a fixed version. {% data variables.product.product_name %} may also notify the maintainers of affected repositories about the new alert according to their notification preferences. For more information, see "[Configuring notifications for vulnerable dependencies](/code-security/supply-chain-security/configuring-notifications-for-vulnerable-dependencies)."
@@ -96,4 +96,4 @@ You can also see all the {% data variables.product.prodname_dependabot_alerts %}
- "[About {% data variables.product.prodname_dependabot_security_updates %}](/github/managing-security-vulnerabilities/about-dependabot-security-updates)"
- "[Viewing and updating vulnerable dependencies in your repository](/articles/viewing-and-updating-vulnerable-dependencies-in-your-repository)"{% endif %}
{% ifversion fpt or ghec %}- "[Understanding how {% data variables.product.prodname_dotcom %} uses and protects your data](/categories/understanding-how-github-uses-and-protects-your-data)"{% endif %}
{% ifversion fpt or ghec %}- "[Privacy on {% data variables.product.prodname_dotcom %}](/get-started/privacy-on-github)"{% endif %}

View File

@@ -49,7 +49,7 @@ You can disable {% data variables.product.prodname_dependabot_security_updates %
| ----------------- | ----------------------- |
| Repository is not a fork | "[About forks](/github/collaborating-with-issues-and-pull-requests/about-forks)" |
| Repository is not archived | "[Archiving repositories](/github/creating-cloning-and-archiving-repositories/archiving-repositories)" |{% ifversion fpt or ghec %}
| Repository is public, or repository is private and you have enabled read-only analysis by {% data variables.product.prodname_dotcom %}, dependency graph, and vulnerability alerts in the repository's settings | "[Managing data use settings for your private repository](/github/understanding-how-github-uses-and-protects-your-data/managing-data-use-settings-for-your-private-repository)." |{% endif %}
| Repository is public, or repository is private and you have enabled read-only analysis by {% data variables.product.prodname_dotcom %}, dependency graph, and vulnerability alerts in the repository's settings | "[Managing data use settings for your private repository](/get-started/privacy-on-github/managing-data-use-settings-for-your-private-repository)." |{% endif %}
| Repository contains dependency manifest file from a package ecosystem that {% data variables.product.prodname_dotcom %} supports | "[Supported package ecosystems](/github/visualizing-repository-data-with-graphs/about-the-dependency-graph#supported-package-ecosystems)" |
| {% data variables.product.prodname_dependabot_security_updates %} are not disabled for the repository | "[Managing {% data variables.product.prodname_dependabot_security_updates %} for your repository](#managing-dependabot-security-updates-for-your-repositories)" |
@@ -75,5 +75,5 @@ You can also enable or disable {% data variables.product.prodname_dependabot_sec
## Further reading
- "[About alerts for vulnerable dependencies](/code-security/supply-chain-security/about-alerts-for-vulnerable-dependencies)"{% ifversion fpt or ghec %}
- "[Managing data use settings for your private repository](/github/understanding-how-github-uses-and-protects-your-data/managing-data-use-settings-for-your-private-repository)"{% endif %}
- "[Managing data use settings for your private repository](/get-started/privacy-on-github/managing-data-use-settings-for-your-private-repository)"{% endif %}
- "[Supported package ecosystems](/github/visualizing-repository-data-with-graphs/about-the-dependency-graph#supported-package-ecosystems)"

View File

@@ -114,5 +114,5 @@ Enterprise owners can configure the dependency graph at an enterprise level. For
- “[关于依赖关系图](/github/visualizing-repository-data-with-graphs/about-the-dependency-graph)”
- "[查看和更新仓库中的漏洞依赖项](/github/managing-security-vulnerabilities/viewing-and-updating-vulnerable-dependencies-in-your-repository)"{% ifversion fpt or ghec %}
- "[查看用于组织的洞见](/organizations/collaborating-with-groups-in-organizations/viewing-insights-for-your-organization)"
- "[了解 {% data variables.product.prodname_dotcom %} 如何使用和保护数据](/github/understanding-how-github-uses-and-protects-your-data)"
- "[了解 {% data variables.product.prodname_dotcom %} 如何使用和保护数据](/get-started/privacy-on-github)"
{% endif %}

View File

@@ -48,7 +48,7 @@ Wikis 可显示 PNG、JPEG 和 GIF 图片。
## 受支持的 MediaWiki 格式
无论您的 wiki 页面以哪种标记语言编写,始终可使用某些 MediaWiki 语法。
- 链接 ([Asciidoc 除外](https://github.com/gollum/gollum/commit/d1cf698b456cd6a35a54c6a8e7b41d3068acec3b))
- Links ([except AsciiDoc](https://github.com/gollum/gollum/commit/d1cf698b456cd6a35a54c6a8e7b41d3068acec3b))
- 水平规则通过 `---`
- 简明符号实体(例如 `&delta;``&euro;`

View File

@@ -17,46 +17,69 @@ topics:
shortTitle: 速率限制
---
## 服务器到服务器请求
{% data reusables.enterprise.rate_limit %}
{% ifversion ghec %}
{% data reusables.rest-api.always-check-your-limit %}
The rate limits for server-to-server requests made by {% data variables.product.prodname_github_apps %} depend on where the app is installed. If the app is installed on organizations or repositories owned by an enterprise on {% data variables.product.product_location %}, then the rate is higher than for installations outside an enterprise.
{% ifversion ghec or fpt %}
### 标准的服务器到服务器速率限制
## About rate limits for apps
Rate limits for {% data variables.product.prodname_github_apps %} and {% data variables.product.prodname_oauth_apps %} depend on the plan for the organization where you install the application. For more information, see "[{% data variables.product.company_short %}'s products](/get-started/learning-about-github/githubs-products)" and "[Types of {% data variables.product.company_short %} accounts](/get-started/learning-about-github/types-of-github-accounts#organization-accounts)."
{% endif %}
{% data reusables.apps.api-rate-limits-non-ghec %}
## 服务器到服务器请求
{% ifversion ghec %}
{% ifversion ghec or fpt %}
### {% data variables.product.prodname_ghe_cloud %} 服务器到服务器速率限制
### Default server-to-server rate limits for {% data variables.product.prodname_dotcom_the_website %}
{% data variables.product.prodname_github_apps %} that are installed on an organization or repository owned by an enterprise on {% data variables.product.product_location %} have a rate limit of 15,000 requests per hour for server-to-server requests.
{% endif %}
发出服务器-服务器请求的 {% data variables.product.prodname_github_apps %} 使用安装的最低速率限制为每小时 5,000 个请求。 If an application is installed on an organization with more than 20 users, the application receives another 50 requests per hour for each user. 具有 20 个以上仓库的安装每小时会为每个仓库再接收 50 个请求。 安装的最大速率限制为每小时 12,500 个请求。
{% ifversion fpt or ghec %}
### Server-to-server rate limits for {% data variables.product.prodname_ghe_cloud %}
{% endif %}
{% ifversion fpt or ghec %}
{% data variables.product.prodname_github_apps %} that are installed on an organization or a repository within an enterprise on {% data variables.product.product_location %} are subject to a limit of 15,000 requests per hour.
{% endif %}
## 用户到服务器请求
{% data variables.product.prodname_github_apps %} 还可以[代表用户](/apps/building-github-apps/identifying-and-authorizing-users-for-github-apps/#identifying-and-authorizing-users-for-github-apps)发送用户到服务器的请求。
{% data variables.product.prodname_github_apps %} and {% data variables.product.prodname_oauth_apps %} can also act on behalf of a user, making user-to-server requests after the user authorizes the app. For more information, see "[Authorizing {% data variables.product.prodname_github_apps %}](/authentication/keeping-your-account-and-data-secure/authorizing-github-apps)" and "[Authorizing {% data variables.product.prodname_oauth_apps %}](/authentication/keeping-your-account-and-data-secure/authorizing-oauth-apps)."
User-to-server requests from {% data variables.product.prodname_oauth_apps %} are authenticated with an OAuth token. User-to-server requests from {% data variables.product.prodname_github_apps %} are authenticated with either an OAuth token or an expiring user access token. For more information, see "[Identifying and authorizing users for {% data variables.product.prodname_github_apps %}](/developers/apps/building-github-apps/identifying-and-authorizing-users-for-github-apps#identifying-and-authorizing-users-for-github-apps)" and "[Authorizing {% data variables.product.prodname_oauth_apps %}](/developers/apps/building-oauth-apps/authorizing-oauth-apps)."
{% ifversion fpt or ghec %}
### Default user-to-server rate limits for {% data variables.product.prodname_dotcom_the_website %}
{% endif %}
{% ifversion ghec %}
The rate limits for user-to-server requests made by {% data variables.product.prodname_github_apps %} depend on where the app is installed. If the app is installed on organizations or repositories owned by an enterprise on {% data variables.product.product_location %}, then the rate is higher than for installations outside an enterprise.
### 标准的用户到服务器速率限制
{% endif %}
{% data reusables.apps.user-to-server-rate-limits %}
{% ifversion fpt or ghec %}
### User-to-server rate limits for {% data variables.product.prodname_ghe_cloud %}
{% data reusables.apps.user-to-server-rate-limits-ghec %}
{% endif %}
User-to-server requests are rate limited at {% ifversion ghae %}15,000{% else %}5,000{% endif %} requests per hour and per authenticated user. 该用户授权的所有 OAuth 应用程序、该用户拥有的个人访问令牌以及使用该用户的{% ifversion ghae %} 令牌{% else %} 用户名和密码{% endif %} 验证的请求,将共享该用户每小时 5,000 个请求的配额。
## 延伸阅读
{% ifversion ghec %}
### {% data variables.product.prodname_ghe_cloud %} 用户到服务器速率限制
When a user belongs to an enterprise on {% data variables.product.product_location %}, user-to-server requests to resources owned by the same enterprise are rate limited at 15,000 requests per hour and per authenticated user. All OAuth applications authorized by that user, personal access tokens owned by that user, and requests authenticated with that user's username and password share the same quota of 5,000 requests per hour for that user.
{% endif %}
有关速率限制的更多信息,请参阅 REST API 的“[速率限制](/rest/overview/resources-in-the-rest-api#rate-limiting)”和 GraphQL API 的“[资源限制]({% ifversion ghec %}/free-pro-team@latest{% endif %}/graphql/overview/resource-limitations)”。
- "[Rate limiting](/rest/overview/resources-in-the-rest-api#rate-limiting)" in the REST API documentation
- "[Resource limitations]({% ifversion ghec %}/free-pro-team@latest{% endif %}/graphql/overview/resource-limitations)" in the GraphQL API documentation

View File

@@ -57,14 +57,14 @@ _授权的_ OAuth 应用程序有权访问用户或组织所有者可访问的
{% endnote %}
| GitHub 应用程序 | OAuth 应用程序 |
| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| GitHub 应用可以使用带外 JSON Web 令牌格式的私钥请求安装访问令牌。 | OAuth 应用程序可以通过 Web 请求在重定向后将请求令牌交换为访问令牌。 |
| 安装程序将应用程序识别为 GitHub 应用自动程序,例如 @jenkins-bot。 | 访问令牌将应用程序识别为向应用程序授予令牌的用户,例如 @octocat。 |
| 安装令牌在预定义的时间(当前为 1 小时)后过期。 | OAuth 令牌在被客户撤销之前一直保持活动状态。 |
| {% data reusables.apps.api-rate-limits-non-ghec %}{% ifversion fpt or ghec %} 更高的速率限制适用于 {% data variables.product.prodname_ghe_cloud %}。 更多信息请参阅“[GitHub 应用程序的速率限制](/developers/apps/rate-limits-for-github-apps)”。{% endif %} | OAuth 令牌使用用户的每小时 5,000 个请求的速率限制。 |
| 速率限制的增加可在 GitHub 应用程序级别(影响所有安装)和单个安装级别上授予。 | 速率限制的增加按 OAuth 应用程序授予。 授予该 OAuth 应用程序的每个令牌都会获得增加的上限。 |
| {% data variables.product.prodname_github_apps %} 可以代表用户进行身份验证,这称为用户到服务器请求。 授权流程与 OAuth 应用程序授权流程相同。 用户到服务器令牌可能会过期,可通过刷新令牌进行续订。 更多信息请参阅“[刷新用户到服务器访问令牌](/apps/building-github-apps/refreshing-user-to-server-access-tokens/)”和“[识别和授权 GitHub 应用程序用户](/apps/building-github-apps/identifying-and-authorizing-users-for-github-apps/)”。 | {% data variables.product.prodname_oauth_apps %} 使用的 OAuth 流程代表用户授权 {% data variables.product.prodname_oauth_app %}。 这与用于 {% data variables.product.prodname_github_app %} 用户到服务器授权中使用的流程相同。 |
| GitHub 应用程序 | OAuth 应用程序 |
| --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| GitHub 应用可以使用带外 JSON Web 令牌格式的私钥请求安装访问令牌。 | OAuth 应用程序可以通过 Web 请求在重定向后将请求令牌交换为访问令牌。 |
| 安装程序将应用程序识别为 GitHub 应用自动程序,例如 @jenkins-bot。 | 访问令牌将应用程序识别为向应用程序授予令牌的用户,例如 @octocat。 |
| 安装令牌在预定义的时间(当前为 1 小时)后过期。 | OAuth 令牌在被客户撤销之前一直保持活动状态。 |
| {% data variables.product.prodname_github_apps %} installed on organizations or repositories are subject to rate limits for server-to-server requests. For more information, see "[Rate limits for {% data variables.product.prodname_github_apps %}](/developers/apps/building-github-apps/rate-limits-for-github-apps)." | OAuth tokens use the user's rate limit of {% ifversion fpt or ghec or ghes %}5,000{% elsif ghae %}15,000{% endif %} requests per hour. |
| 速率限制的增加可在 GitHub 应用程序级别(影响所有安装)和单个安装级别上授予。 | 速率限制的增加按 OAuth 应用程序授予。 授予该 OAuth 应用程序的每个令牌都会获得增加的上限。 |
| {% data variables.product.prodname_github_apps %} can authenticate on behalf of the user, which is called a user-to-server request. 授权流程与 OAuth 应用程序授权流程相同。 用户到服务器令牌可能会过期,可通过刷新令牌进行续订。 更多信息请参阅“[刷新用户到服务器访问令牌](/apps/building-github-apps/refreshing-user-to-server-access-tokens/)”和“[识别和授权 GitHub 应用程序用户](/apps/building-github-apps/identifying-and-authorizing-users-for-github-apps/)”。 | {% data variables.product.prodname_oauth_apps %} 使用的 OAuth 流程代表用户授权 {% data variables.product.prodname_oauth_app %}。 这与用于 {% data variables.product.prodname_github_app %} 用户到服务器授权中使用的流程相同。 |
## 请求资源的权限级别

View File

@@ -28,6 +28,6 @@ shortTitle: REST API
{% note %}
**注:**[REST API 的速率限制](/rest#rate-limiting)适用于所有 {% data variables.product.prodname_marketplace %} API 端点。
**注:**[REST API 的速率限制](/rest/overview/resources-in-the-rest-api#rate-limiting)适用于所有 {% data variables.product.prodname_marketplace %} API 端点。
{% endnote %}

View File

@@ -0,0 +1,31 @@
---
title: 关于 GitHub 导入工具
intro: 如果您在 Subversion、Mercurial、Team Foundation Version Control (TFVC) 或其他 Git 仓库中有源代码,可使用 GitHub 导入工具将其移至 GitHub。
redirect_from:
- /articles/about-github-importer
- /github/importing-your-projects-to-github/about-github-importer
- /github/importing-your-projects-to-github/importing-source-code-to-github/about-github-importer
versions:
fpt: '*'
ghec: '*'
---
GitHub 导入工具是一种可快速将源代码仓库(包括提交和修订记录)导入 GitHub 的工具。
![导入仓库 gif](/assets/images/help/importer/github-importer.gif)
在导入过程中,根据导入来源的版本控制系统,您可以向远程仓库进行身份验证,更新提交作者属性,以及导入包含大文件的仓库(如果不想使用 Git Large File Storage也可删除大文件
| 导入操作 | 子版本Subversion | Mercurial | TFVC | Git |
|:----------------------------------------------------------------------------- |:--------------:|:---------:|:-----:|:-----:|
| 向远程仓库进行身份验证 | **X** | **X** | **X** | **X** |
| [更新提交作者属性](/articles/updating-commit-author-attribution-with-github-importer) | **X** | **X** | **X** | |
| 将大文件移至 [Git Large 文件存储](/articles/about-git-large-file-storage) | **X** | **X** | **X** | |
| 从仓库删除大文件 | **X** | **X** | **X** | |
## 延伸阅读
- "[使用 GitHub 导入工具导入仓库](/articles/importing-a-repository-with-github-importer)"
- "[使用 GitHub 导入工具更新提交作者属性](/articles/updating-commit-author-attribution-with-github-importer)"
- "[使用命令行导入 Git 仓库](/articles/importing-a-git-repository-using-the-command-line)"
- "[源代码迁移工具](/articles/source-code-migration-tools)"

View File

@@ -0,0 +1,165 @@
---
title: Adding an existing project to GitHub using the command line
intro: 'Putting your existing work on {% data variables.product.product_name %} can let you share and collaborate in lots of great ways.'
redirect_from:
- /articles/add-an-existing-project-to-github
- /articles/adding-an-existing-project-to-github-using-the-command-line
- /github/importing-your-projects-to-github/adding-an-existing-project-to-github-using-the-command-line
- /github/importing-your-projects-to-github/importing-source-code-to-github/adding-an-existing-project-to-github-using-the-command-line
versions:
fpt: '*'
ghes: '*'
ghae: '*'
ghec: '*'
shortTitle: Add a project locally
---
## About adding existing projects to {% data variables.product.product_name %}
{% tip %}
**Tip:** If you're most comfortable with a point-and-click user interface, try adding your project with {% data variables.product.prodname_desktop %}. For more information, see "[Adding a repository from your local computer to GitHub Desktop](/desktop/guides/contributing-to-projects/adding-a-repository-from-your-local-computer-to-github-desktop)" in the *{% data variables.product.prodname_desktop %} Help*.
{% endtip %}
{% data reusables.repositories.sensitive-info-warning %}
## Adding a project to {% data variables.product.product_name %} with {% data variables.product.prodname_cli %}
{% data variables.product.prodname_cli %} is an open source tool for using {% data variables.product.prodname_dotcom %} from your computer's command line. {% data variables.product.prodname_cli %} can simplify the process of adding an existing project to {% data variables.product.product_name %} using the command line. To learn more about {% data variables.product.prodname_cli %}, see "[About {% data variables.product.prodname_cli %}](/github-cli/github-cli/about-github-cli)."
1. In the command line, navigate to the root directory of your project.
1. Initialize the local directory as a Git repository.
```shell
git init -b main
```
1. Stage and commit all the files in your project
```shell
git add . && git commit -m "initial commit"
```
1. To create a repository for your project on GitHub, use the `gh repo create` subcommand. When prompted, select **Push an existing local repository to GitHub** and enter the desired name for your repository. If you want your project to belong to an organization instead of your user account, specify the organization name and project name with `organization-name/project-name`.
1. Follow the interactive prompts. To add the remote and push the repository, confirm yes when asked to add the remote and push the commits to the current branch.
1. Alternatively, to skip all the prompts, supply the path to the repository with the `--source` flag and pass a visibility flag (`--public`, `--private`, or `--internal`). For example, `gh repo create --source=. --public`. Specify a remote with the `--remote` flag. To push your commits, pass the `--push` flag. For more information about possible arguments, see the [GitHub CLI manual](https://cli.github.com/manual/gh_repo_create).
## Adding a project to {% data variables.product.product_name %} without {% data variables.product.prodname_cli %}
{% mac %}
1. [Create a new repository](/repositories/creating-and-managing-repositories/creating-a-new-repository) on {% data variables.product.product_location %}. To avoid errors, do not initialize the new repository with *README*, license, or `gitignore` files. You can add these files after your project has been pushed to {% data variables.product.product_name %}.
![Create New Repository drop-down](/assets/images/help/repository/repo-create.png)
{% data reusables.command_line.open_the_multi_os_terminal %}
3. Change the current working directory to your local project.
4. Initialize the local directory as a Git repository.
```shell
$ git init -b main
```
5. Add the files in your new local repository. This stages them for the first commit.
```shell
$ git add .
# Adds the files in the local repository and stages them for commit. {% data reusables.git.unstage-codeblock %}
```
6. Commit the files that you've staged in your local repository.
```shell
$ git commit -m "First commit"
# Commits the tracked changes and prepares them to be pushed to a remote repository. {% data reusables.git.reset-head-to-previous-commit-codeblock %}
```
7. At the top of your repository on {% ifversion ghae %}{% data variables.product.product_name %}{% else %}{% data variables.product.product_location %}{% endif %}'s Quick Setup page, click {% octicon "clippy" aria-label="The copy to clipboard icon" %} to copy the remote repository URL.
![Copy remote repository URL field](/assets/images/help/repository/copy-remote-repository-url-quick-setup.png)
8. In Terminal, [add the URL for the remote repository](/github/getting-started-with-github/managing-remote-repositories) where your local repository will be pushed.
```shell
$ git remote add origin <em> &lt;REMOTE_URL> </em>
# Sets the new remote
$ git remote -v
# Verifies the new remote URL
```
9. [Push the changes](/github/getting-started-with-github/pushing-commits-to-a-remote-repository/) in your local repository to {% data variables.product.product_location %}.
```shell
$ git push -u origin main
# Pushes the changes in your local repository up to the remote repository you specified as the origin
```
{% endmac %}
{% windows %}
1. [Create a new repository](/articles/creating-a-new-repository) on {% data variables.product.product_location %}. To avoid errors, do not initialize the new repository with *README*, license, or `gitignore` files. You can add these files after your project has been pushed to {% data variables.product.product_name %}.
![Create New Repository drop-down](/assets/images/help/repository/repo-create.png)
{% data reusables.command_line.open_the_multi_os_terminal %}
3. Change the current working directory to your local project.
4. Initialize the local directory as a Git repository.
```shell
$ git init -b main
```
5. Add the files in your new local repository. This stages them for the first commit.
```shell
$ git add .
# Adds the files in the local repository and stages them for commit. {% data reusables.git.unstage-codeblock %}
```
6. Commit the files that you've staged in your local repository.
```shell
$ git commit -m "First commit"
# Commits the tracked changes and prepares them to be pushed to a remote repository. {% data reusables.git.reset-head-to-previous-commit-codeblock %}
```
7. At the top of your repository on {% ifversion ghae %}{% data variables.product.product_name %}{% else %}{% data variables.product.product_location %}{% endif %}'s Quick Setup page, click {% octicon "clippy" aria-label="The copy to clipboard icon" %} to copy the remote repository URL.
![Copy remote repository URL field](/assets/images/help/repository/copy-remote-repository-url-quick-setup.png)
8. In the Command prompt, [add the URL for the remote repository](/github/getting-started-with-github/managing-remote-repositories) where your local repository will be pushed.
```shell
$ git remote add origin <em> &lt;REMOTE_URL> </em>
# Sets the new remote
$ git remote -v
# Verifies the new remote URL
```
9. [Push the changes](/github/getting-started-with-github/pushing-commits-to-a-remote-repository/) in your local repository to {% data variables.product.product_location %}.
```shell
$ git push origin main
# Pushes the changes in your local repository up to the remote repository you specified as the origin
```
{% endwindows %}
{% linux %}
1. [Create a new repository](/articles/creating-a-new-repository) on {% data variables.product.product_location %}. To avoid errors, do not initialize the new repository with *README*, license, or `gitignore` files. You can add these files after your project has been pushed to {% data variables.product.product_name %}.
![Create New Repository drop-down](/assets/images/help/repository/repo-create.png)
{% data reusables.command_line.open_the_multi_os_terminal %}
3. Change the current working directory to your local project.
4. Initialize the local directory as a Git repository.
```shell
$ git init -b main
```
5. Add the files in your new local repository. This stages them for the first commit.
```shell
$ git add .
# Adds the files in the local repository and stages them for commit. {% data reusables.git.unstage-codeblock %}
```
6. Commit the files that you've staged in your local repository.
```shell
$ git commit -m "First commit"
# Commits the tracked changes and prepares them to be pushed to a remote repository. {% data reusables.git.reset-head-to-previous-commit-codeblock %}
```
7. At the top of your repository on {% ifversion ghae %}{% data variables.product.product_name %}{% else %}{% data variables.product.product_location %}{% endif %}'s Quick Setup page, click {% octicon "clippy" aria-label="The copy to clipboard icon" %} to copy the remote repository URL.
![Copy remote repository URL field](/assets/images/help/repository/copy-remote-repository-url-quick-setup.png)
8. In Terminal, [add the URL for the remote repository](/github/getting-started-with-github/managing-remote-repositories) where your local repository will be pushed.
```shell
$ git remote add origin <em> &lt;REMOTE_URL> </em>
# Sets the new remote
$ git remote -v
# Verifies the new remote URL
```
9. [Push the changes](/github/getting-started-with-github/pushing-commits-to-a-remote-repository/) in your local repository to {% data variables.product.product_location %}.
```shell
$ git push origin main
# Pushes the changes in your local repository up to the remote repository you specified as the origin
```
{% endlinux %}
## Further reading
- "[Adding a file to a repository](/repositories/working-with-files/managing-files/adding-a-file-to-a-repository#adding-a-file-to-a-repository-using-the-command-line)"

View File

@@ -0,0 +1,48 @@
---
title: 使用命令行导入 Git 仓库
intro: '{% ifversion fpt %}如果 [GitHub Importer](/articles/importing-a-repository-with-github-importer) 不适用于您的目的,例如,如果您现有的代码托管在私有网络上,则我们建议使用命令行导入。{% else %}当您现有的代码托管在私有网络上时,适合使用命令行导入 Git 项目。{% endif %}'
redirect_from:
- /articles/importing-a-git-repository-using-the-command-line
- /github/importing-your-projects-to-github/importing-a-git-repository-using-the-command-line
- /github/importing-your-projects-to-github/importing-source-code-to-github/importing-a-git-repository-using-the-command-line
versions:
fpt: '*'
ghes: '*'
ghae: '*'
ghec: '*'
shortTitle: 本地导入仓库
---
在开始之前,请确保您知道:
- 您的 {% data variables.product.product_name %} 用户名
- 外部仓库的克隆 URL`https://external-host.com/user/repo.git``git://external-host.com/user/repo.git`(或许 `external-host.com` 域名前面是 `user@`
{% tip %}
为便于示范,我们将使用:
- 外部帐户 **extuser**
- 外部 Git 主机 `https://external-host.com`
- {% data variables.product.product_name %} 个人用户帐户 **ghuser**
- {% ifversion ghae %}{% data variables.product.product_name %}{% else %}{% data variables.product.product_location %}{% endif %} 上名为 **repo.git** 的仓库
{% endtip %}
1. [在 {% data variables.product.product_name %} 上创建新仓库](/articles/creating-a-new-repository)。 您将在此新仓库中导入外部 Git 仓库。
2. 在命令行上,使用外部克隆 URL 创建仓库的“裸”克隆。 这会创建数据的完整副本,但没有编辑文件的工作目录,并确保干净、新鲜地导出所有旧数据。
```shell
$ git clone --bare https://external-host.com/<em>extuser</em>/<em>repo.git</em>
# Makes a bare clone of the external repository in a local directory
```
3. 使用“镜像”选项将本地克隆的仓库推送到 {% data variables.product.product_name %},以确保所有引用(如分支和标记)都复制到导入的仓库。
```shell
$ cd <em>repo.git</em>
$ git push --mirror https://{% data variables.command_line.codeblock %}/<em>ghuser</em>/<em>repo.git</em>
# Pushes the mirror to the new repository on {% ifversion ghae %}{% data variables.product.product_name %}{% else %}{% data variables.product.product_location %}{% endif %}
```
4. 删除临时本地仓库。
```shell
$ cd ..
$ rm -rf <em>repo.git</em>
```

View File

@@ -0,0 +1,38 @@
---
title: 使用 GitHub 导入工具导入仓库
intro: 如果您有项目托管在另一个版本控制系统上,可以使用 GitHub 导入工具将其自动导入到 GitHub。
redirect_from:
- /articles/importing-from-other-version-control-systems-to-github
- /articles/importing-a-repository-with-github-importer
- /github/importing-your-projects-to-github/importing-a-repository-with-github-importer
- /github/importing-your-projects-to-github/importing-source-code-to-github/importing-a-repository-with-github-importer
versions:
fpt: '*'
ghec: '*'
shortTitle: 使用 GitHub 导入工具
---
{% tip %}
**提示:**GitHub 导入工具不适用于所有导入。 例如,如果您现有的代码托管在私有网络上,我们的工具便无法访问。 在这些情况下,我们建议对 Git 仓库[使用命令行导入](/articles/importing-a-git-repository-using-the-command-line),或者对导入自其他版本控制系统的项目使用[源代码迁移工具](/articles/source-code-migration-tools)。
{% endtip %}
如果在导入时要将仓库中的提交匹配到作者的 GitHub 用户帐户,请确保在开始导入之前,仓库的每个贡献者都有 GitHub 帐户。
{% data reusables.repositories.repo-size-limit %}
1. 在任何页面的右上角,单击 {% octicon "plus" aria-label="Plus symbol" %},然后单击 **Import repository导入仓库**。 ![新仓库菜单中的导入仓库选项](/assets/images/help/importer/import-repository.png)
2. 在 "Your old repository's clone URL"(您的旧仓库的克隆 URL输入要导入的项目的 URL。 ![导入的仓库 URL 对应的文本字段](/assets/images/help/importer/import-url.png)
3. 选择拥有仓库的用户帐户或组织,然后输入 GitHub 上帐户的名称。 ![仓库所有者菜单和仓库名称字段](/assets/images/help/importer/import-repo-owner-name.png)
4. 指定新仓库是*公共*还是*私有*。 更多信息请参阅“[设置仓库可见性](/articles/setting-repository-visibility)”。 ![公共或私有仓库单选按钮](/assets/images/help/importer/import-public-or-private.png)
5. 检查您输入的信息,然后单击 **Begin import开始导入**。 ![开始导入按钮](/assets/images/help/importer/begin-import-button.png)
6. 如果您的旧项目有密码保护,请输入该项目的登录信息,然后单击 **Submit提交**。 ![有密码保护项目的密码表单和提交按钮](/assets/images/help/importer/submit-old-credentials-importer.png)
7. 如果有多个项目托管于旧项目的克隆 URL 上,请选择要导入的项目,然后单击 **Submit提交**。 ![要导入的项目列表和提交按钮](/assets/images/help/importer/choose-project-importer.png)
8. 如果项目包含超过 100 MB 的大文件,请选择是否使用 [Git Large File Storage](/articles/versioning-large-files) 导入大文件,然后单击 **Continue继续**。 ![Git Large File Storage 菜单和继续按钮](/assets/images/help/importer/select-gitlfs-importer.png)
在仓库完成导入时,您会收到一封电子邮件。
## 延伸阅读
- "[使用 GitHub 导入工具更新提交作者属性](/articles/updating-commit-author-attribution-with-github-importer)"

View File

@@ -0,0 +1,25 @@
---
title: 将源代码导入到 GitHub
intro: '您可以使用 {% ifversion fpt %}GitHub 导入工具、命令行、{% else %}命令行{% endif %}或外部迁移工具将仓库导入到 GitHub。'
redirect_from:
- /articles/importing-an-external-git-repository
- /articles/importing-from-bitbucket
- /articles/importing-an-external-git-repo
- /articles/importing-your-project-to-github
- /articles/importing-source-code-to-github
- /github/importing-your-projects-to-github/importing-source-code-to-github
versions:
fpt: '*'
ghes: '*'
ghae: '*'
ghec: '*'
children:
- /about-github-importer
- /importing-a-repository-with-github-importer
- /updating-commit-author-attribution-with-github-importer
- /importing-a-git-repository-using-the-command-line
- /adding-an-existing-project-to-github-using-the-command-line
- /source-code-migration-tools
shortTitle: 导入代码到 GitHub
---

View File

@@ -0,0 +1,59 @@
---
title: 源代码迁移工具
intro: 您可以使用外部工具将项目移动到 GitHub。
redirect_from:
- /articles/importing-from-subversion
- /articles/source-code-migration-tools
- /github/importing-your-projects-to-github/source-code-migration-tools
- /github/importing-your-projects-to-github/importing-source-code-to-github/source-code-migration-tools
versions:
fpt: '*'
ghes: '*'
ghae: '*'
ghec: '*'
shortTitle: 代码迁移工具
---
{% ifversion fpt or ghec %}
我们建议使用 [GitHub 导入工具](/articles/about-github-importer)从 Subversion、Mercurial、Team Foundation Version Control (TFVC) 或其他 Git 仓库导入项目。 您还可以使用这些外部工具将项目转换为 Git。
{% endif %}
## 从 Subversion 导入
在典型 Subversion 环境中,多个项目存储在一个根仓库中。 在 GitHub 上,这些项目的每一个通常都将映射到用户帐户或组织的单独 Git 仓库。 以下情况时,我们建议将 Subversion 仓库的每一部分导入到单独的 GitHub 仓库:
* 协作者需要检出或提交到独立于项目其他部分的部分
* 您想要不同的部分有其自己的访问权限
我们建议使用以下工具将 Subversion 仓库转换为 Git
- [`git-svn`](https://git-scm.com/docs/git-svn)
- [svn2git](https://github.com/nirvdrum/svn2git)
## 从 Mercurial 导入
我们建议使用 [hg-fast-export](https://github.com/frej/fast-export) 将 Mercurial 仓库转换为 Git。
## 从 TFVC 导入
我们建议 [git-tfs](https://github.com/git-tfs/git-tfs) 用于在TFVC 和 Git 之间移动更改。
For more information about moving from TFVC (a centralized version control system) to Git, see "[Plan your Migration to Git](https://docs.microsoft.com/devops/develop/git/centralized-to-git)" from the Microsoft docs site.
{% tip %}
**提示:**在成功地将项目转换为 Git 后,您可以[将其推送到 {% data variables.product.prodname_dotcom %}](/github/getting-started-with-github/pushing-commits-to-a-remote-repository/)。
{% endtip %}
{% ifversion fpt or ghec %}
## 延伸阅读
- “[关于 GitHub 导入工具](/articles/about-github-importer)”
- "[使用 GitHub 导入工具导入仓库](/articles/importing-a-repository-with-github-importer)"
- [{% data variables.product.prodname_learning %}]({% data variables.product.prodname_learning_link %})
{% endif %}

View File

@@ -0,0 +1,43 @@
---
title: 使用 GitHub 导入工具更新提交作者归属
intro: 导入期间,您可以将仓库中的提交匹配提交作者的 GitHub 帐户。
redirect_from:
- /articles/updating-commit-author-attribution-with-github-importer
- /github/importing-your-projects-to-github/updating-commit-author-attribution-with-github-importer
- /github/importing-your-projects-to-github/importing-source-code-to-github/updating-commit-author-attribution-with-github-importer
versions:
fpt: '*'
ghec: '*'
shortTitle: 更新作者 GitHub 导入工具
---
GitHub 导入工具查找其电子邮件地址匹配您所导入仓库中提交作者的 GitHub 用户。 然后,您可以使用其电子邮件地址或作者的 GitHub 用户名将提交连接到其作者。
## 更新提交作者
1. 导入仓库后,在导入状态页面上,单击 **Match authors匹配作者**。 ![匹配作者按钮](/assets/images/help/importer/match-authors-button.png)
2. 在您想要更新其信息的作者旁边,单击 **Connect连接**。 ![提交作者列表](/assets/images/help/importer/connect-commit-author.png)
3. 输入作者的电子邮件地址或 GitHub 用户名,然后按 **Enter** 键。
## 将提交归于具有公共电子邮件地址的 GitHub 用户
如果导入的仓库中的提交作者具有与其用于创作提交的电子邮件地址关联的 GitHub 帐户,并且他们没有[将其提交电子邮件地址设为私有](/articles/setting-your-commit-email-address),则 GitHub 导入工具会将与提交关联的电子邮件地址匹配与其 GitHub 帐户关联的公共电子邮件地址,并将提交归于其 GitHub 帐户。
## 将提交归于没有公共电子邮件地址的 GitHub 用户
如果导入的仓库中的提交作者既没有在其 GitHub 个人资料中设置公共电子邮件地址,也没有[将其提交电子邮件地址设为私有](/articles/setting-your-commit-email-address),则 GitHub 导入工具可能无法将与提交关联的电子邮件地址匹配其 GitHub 帐户。
提交作者可通过将其电子邮件地址设为私有来解决此问题。 其提交随后归于 `<username>@users.noreply.github.com`,导入的提交将与其 GitHub 帐户关联。
## 使用电子邮件地址归属提交
如果作者的电子邮件地址没有与其 GitHub 帐户关联,他们可以在导入后[将地址添加到其帐户](/articles/adding-an-email-address-to-your-github-account),然后即可正确归属提交。
如果作者没有 GitHub 帐户,则 GitHub 导入工具会将其提交归于与提交关联的电子邮件地址。
## 延伸阅读
- “[关于 GitHub 导入工具](/articles/about-github-importer)”
- "[使用 GitHub 导入工具导入仓库](/articles/importing-a-repository-with-github-importer)"
- “[将电子邮件地址添加到您的帐户](/articles/adding-an-email-address-to-your-github-account/)”
- "[设置提交电子邮件地址](/articles/setting-your-commit-email-address)"

View File

@@ -0,0 +1,19 @@
---
title: 将项目导入到 GitHub
intro: '您可以使用多种不同方法将源代码导入到 {% data variables.product.product_name %}。'
shortTitle: 导入项目
redirect_from:
- /categories/67/articles
- /categories/importing
- /categories/importing-your-projects-to-github
- /github/importing-your-projects-to-github
versions:
fpt: '*'
ghes: '*'
ghae: '*'
ghec: '*'
children:
- /importing-source-code-to-github
- /working-with-subversion-on-github
---

View File

@@ -0,0 +1,17 @@
---
title: 在 GitHub 上使用 Subversion
intro: 您可以将 Subversion 客户端以及一些 Subversion 工作流程和属性与 GitHub 一起使用。
redirect_from:
- /articles/working-with-subversion-on-github
- /github/importing-your-projects-to-github/working-with-subversion-on-github
versions:
fpt: '*'
ghes: '*'
ghec: '*'
children:
- /what-are-the-differences-between-subversion-and-git
- /support-for-subversion-clients
- /subversion-properties-supported-by-github
shortTitle: 在 GitHub 上使用 Subversion
---

View File

@@ -0,0 +1,29 @@
---
title: GitHub 支持的 Subversion 属性
intro: '有几个 Subversion 工作流和属性与 {% data variables.product.product_name %} 上现有的功能类似。'
redirect_from:
- /articles/subversion-properties-supported-by-github
- /github/importing-your-projects-to-github/subversion-properties-supported-by-github
- /github/importing-your-projects-to-github/working-with-subversion-on-github/subversion-properties-supported-by-github
versions:
fpt: '*'
ghes: '*'
ghec: '*'
shortTitle: GitHub 支持的属性
---
## 可执行文件 (svn:executable)
我们通过在将文件模式添加到 Git 仓库之前直接进行更新来转换 `svn:executable` 属性。
## MIME 类型 (svn:mime-type)
{% data variables.product.product_name %} 内部跟踪文件的 mime 类型和添加它们的提交。
## 忽略未版本化的项目 (svn:ignore)
如果您已设置要在 Subversion 中忽略的文件和目录,{% data variables.product.product_name %} 将在内部跟踪它们。 Subversion 客户端忽略的文件与 *.gitignore* 文件中的条目完全不同。
## 目前不支持的属性
{% data variables.product.product_name %} 目前不支持 `svn:externals``svn:global-ignores` 或上面未列出的任何属性,包括自定义属性。

View File

@@ -0,0 +1,134 @@
---
title: Subversion 客户端支持
intro: GitHub 仓库可从 Git 和 Subversion (SVN) 客户端进行访问。 本文介绍如何在 GitHub 上使用 Subversion 客户端以及您可能遇到的一些常见问题。
redirect_from:
- /articles/support-for-subversion-clients
- /github/importing-your-projects-to-github/support-for-subversion-clients
- /github/importing-your-projects-to-github/working-with-subversion-on-github/support-for-subversion-clients
versions:
fpt: '*'
ghes: '*'
ghec: '*'
shortTitle: Subversion 客户端支持
---
GitHub 通过 HTTPS 协议支持 Subversion 客户端。 我们使用 Subversion 网桥将 svn 命令传递给 GitHub。
## GitHub 上支持的 Subversion 功能
### 检出
您首先要进行 Subversion 检出。 由于 Git 克隆将工作目录(您编辑文件的位置)与仓库数据分开,因此工作目录中一次只有一个分支。
Subversion 检出则不同:它们混合工作目录中的仓库数据,因此存在用于您已检出的每个分支和标记的工作目录。 对于具有许多分支和标记的仓库,检出所有内容可能会造成带宽负担,因此应从部分检出开始。
{% data reusables.repositories.navigate-to-repo %}
{% data reusables.repositories.copy-clone-url %}
3. 进行仓库的空检出:
```shell
$ svn co --depth empty https://github.com/<em>user</em>/<em>repo</em>
> Checked out revision 1.
$ cd <em>repo</em>
```
4. 获取 `trunk` 分支。 Subversion 网桥将主干映射到 Git HEAD 分支。
```shell
$ svn up trunk
> A trunk
> A trunk/README.md
> A trunk/gizmo.rb
> Updated to revision 1.
```
5. 获取 `branches` 目录的空检出。 这是所有非 `HEAD` 分支所在的位置,您将在此处进行功能分支。
```shell
$ svn up --depth empty branches
Updated to revision 1.
```
### 创建分支
您还可以使用到 GitHub 的 Subversion 网桥创建分支。
从 svn 客户端更新 `trunk`,以确保 "master" 是最新的:
```shell
$ svn up trunk
> At revision 1.
```
接下来,您可以使用 `svn copy` 创建新分支:
```shell
$ svn copy trunk branches/more_awesome
> A branches/more_awesome
$ svn commit -m 'Added more_awesome topic branch'
> Adding branches/more_awesome
> Committed revision 2.
```
您可以在仓库的分支下拉菜单中确认存在新分支:
![分支快照](/assets/images/help/branch/svnflow-branch-snapshot.png)
您还可以通过命令行确认新分支:
```shell
$ git fetch
> From https://github.com/<em>user</em>/<em>repo</em>/
> * [new branch] more_awesome -> origin/more_awesome
```
### 对 Subversion 进行提交
添加一些功能并修复一些漏洞后,您想要将这些更改提交到 GitHub。 此工作正如您惯用的 Subversion 一样。 编辑文件,然后使用 `svn commit` 记录您的更改:
```shell
$ svn status
> M gizmo.rb
$ svn commit -m 'Guard against known problems'
> Sending more_awesome/gizmo.rb
> Transmitting file data .
> Committed revision 3.
$ svn status
> ? test
$ svn add test
> A test
> A test/gizmo_test.rb
$ svn commit -m 'Test coverage for problems'
> Adding more_awesome/test
> Adding more_awesome/test/gizmo_test.rb
> Transmitting file data .
> Committed revision 4.
```
### 在分支间切换
要在分支之间切换,您可能想要从 `trunk` 的检出开始:
```shell
$ svn co --depth empty https://github.com/<em>user</em>/<em>repo</em>/trunk
```
然后,您可以切换到另一个分支:
```shell
$ svn switch https://github.com/<em>user</em>/<em>repo</em>/branches/more_awesome
```
## 为 Subversion 提交查找 Git 提交 SHA
GitHub 的 Subversion 服务器公开每个 Subversion 提交的 Git 提交 sha。
要查看提交 SHA应请求 `git-commit` 未版本化的远程属性。
```shell
$ svn propget git-commit --revprop -r HEAD https://github.com/<em>user</em>/<em>repo</em>
05fcc584ed53d7b0c92e116cb7e64d198b13c4e3
```
使用此提交 SHA举例来说您可以在 GitHub 上查找相应的 Git 提交。
## 延伸阅读
* “[GitHub 支持的 Subversion 属性](/articles/subversion-properties-supported-by-github)”

View File

@@ -0,0 +1,71 @@
---
title: Subversion 和 Git 有哪些区别?
intro: Subversion (SVN) 仓库与 Git 仓库类似,但涉及项目架构时有一些区别。
redirect_from:
- /articles/what-are-the-differences-between-svn-and-git
- /articles/what-are-the-differences-between-subversion-and-git
- /github/importing-your-projects-to-github/what-are-the-differences-between-subversion-and-git
- /github/importing-your-projects-to-github/working-with-subversion-on-github/what-are-the-differences-between-subversion-and-git
versions:
fpt: '*'
ghes: '*'
ghec: '*'
shortTitle: Subversion 与 Git 差异
---
## 目录结构
项目中的每个*引用*或标记的提交快照均在特定子目录中组织,例如 `trunk``branches``tags`。 例如,具有两项正在开发的功能的 SVN 项目可能类似如下:
sample_project/trunk/README.md
sample_project/trunk/lib/widget.rb
sample_project/branches/new_feature/README.md
sample_project/branches/new_feature/lib/widget.rb
sample_project/branches/another_new_feature/README.md
sample_project/branches/another_new_feature/lib/widget.rb
SVN 工作流程可能类似如下:
* `trunk` 目录表示项目的最新稳定发行版。
* 活动功能工作在 `branches` 下的子目录内进行开发。
* 功能完成后,该功能目录将合并到 `trunk` 中并删除。
Git 项目也存储在一个目录中。 不过Git 通过将其引用存储在一个特殊的 *.git* 目录中来模糊其详细信息。 例如,具有两项正在开发的功能的 Git 项目可能类似如下:
sample_project/.git
sample_project/README.md
sample_project/lib/widget.rb
Git 工作流程可能类似如下:
* Git 仓库在 *.git* 目录中存储所有其分支和标记的完整历史记录。
* 最新稳定发行版包含在默认分支中。
* 活动功能工作在单独的分支中进行开发。
* 功能完成后,该功能分支将合并到默认分支中并删除。
与 SVN 不同的是,使用 Git 时目录结构保持不变,但文件内容会根据您的分支而变化。
## 包括子项目
*子项目*是在主项目之外的某个位置开发和管理的项目。 您通常导入子项目以将一些功能添加到您的项目,而无需自行维护代码。 每当子项目更新时,您可以将其与您的项目同步,以确保所有内容都是最新的。
在 SVN 中,子项目称为 *SVN 外部*。 在 Git 中,它称为 *Git 子模块*。 尽管在概念上类似,但 Git 子模块不会自动保持最新状态;您必须明确要求才能将新版本带入您的项目。
更多信息请参阅 Git 文档中的“[Git 工具子模块](https://git-scm.com/book/en/Git-Tools-Submodules)”。
## 保留历史记录
SVN 配置为假设项目的历史记录永不更改。 Git 允许您使用 [`git rebase`](/github/getting-started-with-github/about-git-rebase) 等工具修改以前的提交和更改。
{% tip %}
[GitHub 支持 Subversion 客户端](/articles/support-for-subversion-clients),如果您在同一项目内同时使用 Git 和 SVN可能会产生一些意外的结果。 如果您操纵了 Git 的提交历史记录,这些相同的提交在 SVN 的历史记录中将始终保留。 如果意外提交了一些敏感数据,我们有[一篇文章可帮助您将其从 Git 的历史中删除](/articles/removing-sensitive-data-from-a-repository)。
{% endtip %}
## 延伸阅读
- “[GitHub 支持的 Subversion 属性](/articles/subversion-properties-supported-by-github)”
- [_Git SCM_ 书籍中的“分支与合并”](https://git-scm.com/book/en/Git-Branching-Basic-Branching-and-Merging)
- “[将源代码导入到 GitHub](/articles/importing-source-code-to-github)”
- "[源代码迁移工具](/articles/source-code-migration-tools)"

View File

@@ -57,8 +57,11 @@ children:
- /learning-about-github
- /signing-up-for-github
- /using-github
- /writing-on-github
- /importing-your-projects-to-github
- /exploring-projects-on-github
- /getting-started-with-git
- /using-git
- /privacy-on-github
---

View File

@@ -47,11 +47,11 @@ When you read {% data variables.product.prodname_docs %}, make sure to select th
- 私有仓库中的高级工具和洞察力:
- 必需拉取请求审查
- 多个拉取请求审查者
- 受保护分支
- 代码所有者
- 自动链接的引用
- {% data variables.product.prodname_pages %}
- Wikis
- 受保护分支
- 代码所有者
- 仓库洞察图:脉冲、贡献者、流量、提交、代码频率、网络和复刻
## 组织的 {% data variables.product.prodname_free_team %}
@@ -74,14 +74,14 @@ When you read {% data variables.product.prodname_docs %}, make sure to select th
- 私有仓库中的高级工具和洞察力:
- 必需拉取请求审查
- 多个拉取请求审查者
- {% data variables.product.prodname_pages %}
- Wikis
- 受保护分支
- 代码所有者
- 仓库洞察图:脉冲、贡献者、流量、提交、代码频率、网络和复刻
- 草稿拉取请求
- 团队拉取请求审查
- 受保护分支
- 代码所有者
- 预定提醒
- {% data variables.product.prodname_pages %}
- Wikis
- 仓库洞察图:脉冲、贡献者、流量、提交、代码频率、网络和复刻
{% ifversion fpt or ghec %}
- The option to enable {% data variables.product.prodname_github_codespaces %}
- Organization owners can enable {% data variables.product.prodname_github_codespaces %} for the organization by setting a spending limit and granting user permissions for members of their organization. For more information, see "[Enabling Codespaces for your organization](/codespaces/managing-codespaces-for-your-organization/enabling-codespaces-for-your-organization)."

View File

@@ -0,0 +1,41 @@
---
title: 关于 GitHub 使用您的数据
redirect_from:
- /articles/about-github-s-use-of-your-data
- /articles/about-githubs-use-of-your-data
- /github/understanding-how-github-uses-and-protects-your-data/about-githubs-use-of-your-data
intro: '{% data variables.product.product_name %} 使用您的仓库数据来将您连接到相关工具、人员、项目和信息。'
versions:
fpt: '*'
ghec: '*'
topics:
- Policy
- Legal
shortTitle: GitHub 对您的数据的使用
---
## 关于 {% data variables.product.product_name %} 使用您的数据
{% data variables.product.product_name %} 汇总元数据并剖析内容模式,以在产品中提交一般化的见解。 它使用公共仓库中的数据,当仓库所有者选择与 {% data variables.product.product_name %} 共享数据时还会使用私有仓库中的元数据并汇总数据。 如果选择使用私有仓库的数据,它会对特定私有仓库执行只读分析。
{% data reusables.repositories.about-github-archive-program %} 更多信息请参阅“[关于在 {% data variables.product.prodname_dotcom %} 上存档内容](/github/creating-cloning-and-archiving-repositories/about-archiving-content-and-data-on-github#about-the-github-archive-program)”。
{% data reusables.user_settings.export-data %} 更多信息请参阅“[请求个人帐户数据的存档](/articles/requesting-an-archive-of-your-personal-account-s-data)”。
如果您选择使用私人仓库的数据,我们将继续按照[服务条款](/free-pro-team@latest/github/site-policy/github-terms-of-service),将您的私人数据、源代码或商业秘密视为机密和私密。 我们了解的信息只来自汇总的数据。 更多信息请参阅“[管理私有仓库的数据使用设置](/get-started/privacy-on-github/managing-data-use-settings-for-your-private-repository)”。
我们会在 [{% data variables.product.prodname_dotcom %} 博客](https://github.com/blog)中宣布使用元数据或汇总数据的重要新功能。
## 数据如何改进安全建议
例如,在使用您的数据时,我们可能会检测您的公共仓库依赖项中的安全漏洞并提醒您。 更多信息请参阅“[关于易受攻击的依赖项的警报](/github/managing-security-vulnerabilities/about-alerts-for-vulnerable-dependencies)”。
为检测潜在安全漏洞,{% data variables.product.product_name %} 会扫描依赖项清单文件的内容,以列出项目的依赖项。
{% data variables.product.product_name %} 还会获知您对依赖项清单所做的更改。 例如,如果您在获得安全警报后将有漏洞的依赖项升级到安全版本,其他人也执行同样的操作,{% data variables.product.product_name %} 就会了解如何修补漏洞,并对受影响的仓库推荐类似的补丁。
## 隐私和数据共享
私有仓库数据由电脑扫描,{% data variables.product.product_name %} 员工不能查看。 除了我们[服务条款](/free-pro-team@latest/github/site-policy/github-terms-of-service#3-access)中所述的内容之外,绝不会有人查看私有仓库的内容。
您的个别人员或仓库数据不会与第三方共享。 我们可能与合作伙伴共享分析后获得的汇总数据。

View File

@@ -0,0 +1,16 @@
---
title: Privacy on GitHub
redirect_from:
- /categories/understanding-how-github-uses-and-protects-your-data
- /github/understanding-how-github-uses-and-protects-your-data
versions:
fpt: '*'
ghec: '*'
children:
- /about-githubs-use-of-your-data
- /requesting-an-archive-of-your-personal-accounts-data
- /managing-data-use-settings-for-your-private-repository
- /opting-into-or-out-of-the-github-archive-program-for-your-public-repository
shortTitle: Privacy on GitHub
---

View File

@@ -0,0 +1,36 @@
---
title: Managing data use settings for your private repository
intro: 'To help {% data variables.product.product_name %} connect you to relevant tools, people, projects, and information, you can configure data use for your private repository.'
redirect_from:
- /articles/opting-into-or-out-of-data-use-for-your-private-repository
- /github/understanding-how-github-uses-and-protects-your-data/opting-into-or-out-of-data-use-for-your-private-repository
- /github/understanding-how-github-uses-and-protects-your-data/managing-data-use-settings-for-your-private-repository
versions:
fpt: '*'
ghec: '*'
topics:
- Policy
- Legal
shortTitle: Manage data use for private repo
---
## About data use for your private repository
When you enable data use for your private repository, you'll be able to access the dependency graph, where you can track your repository's dependencies and receive {% data variables.product.prodname_dependabot_alerts %} when {% data variables.product.product_name %} detects vulnerable dependencies. For more information, see "[About alerts for vulnerable dependencies](/github/managing-security-vulnerabilities/about-alerts-for-vulnerable-dependencies#dependabot-alerts-for-vulnerable-dependencies)."
## Enabling or disabling data use features
{% data reusables.security.security-and-analysis-features-enable-read-only %}
{% data reusables.repositories.navigate-to-repo %}
{% data reusables.repositories.sidebar-settings %}
{% data reusables.repositories.navigate-to-security-and-analysis %}
4. Under "Configure security and analysis features", to the right of the feature, click **Disable** or **Enable**.{% ifversion fpt %}
!["Enable" or "Disable" button for "Configure security and analysis" features](/assets/images/help/repository/security-and-analysis-disable-or-enable-fpt-private.png){% elsif ghec %}
!["Enable" or "Disable" button for "Configure security and analysis" features](/assets/images/help/repository/security-and-analysis-disable-or-enable-ghec-private.png){% endif %}
## Further reading
- "[About {% data variables.product.prodname_dotcom %}'s use of your data](/articles/about-github-s-use-of-your-data)"
- "[Viewing and updating vulnerable dependencies in your repository](/github/managing-security-vulnerabilities/viewing-and-updating-vulnerable-dependencies-in-your-repository)"
- "[Managing security and analysis settings for your repository](/github/administering-a-repository/managing-security-and-analysis-settings-for-your-repository)"

View File

@@ -0,0 +1,25 @@
---
title: 选择加入或退出公共仓库的 GitHub 存档计划
intro: '您可以管理 {% data variables.product.prodname_dotcom %} 是否将您的公共仓库包含在 {% data variables.product.prodname_archive %} 中,以帮助确保长期保存世界的开源软件。'
permissions: 'People with admin permissions to a public repository can opt into or out of the {% data variables.product.prodname_archive %}.'
redirect_from:
- /github/understanding-how-github-uses-and-protects-your-data/opting-into-or-out-of-the-github-archive-program-for-your-public-repository
versions:
fpt: '*'
ghec: '*'
topics:
- Policy
- Legal
shortTitle: GitHub 存档计划
---
{% data reusables.repositories.about-github-archive-program %} 更多信息请参阅“[关于在 {% data variables.product.prodname_dotcom %} 上存档内容](/github/creating-cloning-and-archiving-repositories/about-archiving-content-and-data-on-github#about-the-github-archive-program)”。
如果您对仓库选择退出 {% data variables.product.prodname_archive %},该仓库将被排除在 {% data variables.product.prodname_dotcom %} 未来可能创建的任何长期存档之外。 我们还会向每个合作伙伴组织发送请求,请求从他们的数据中删除该仓库。
{% data reusables.repositories.navigate-to-repo %}
{% data reusables.repositories.sidebar-settings %}
3. 在“Features功能”下选择或取消选择 **Preserve this repository保存此仓库**。 ![允许 {% data variables.product.prodname_dotcom %} 在 {% data variables.product.prodname_archive %} 中包含您的代码的复选框](/assets/images/help/repository/github-archive-program-checkbox.png)
## 延伸阅读
- [{% data variables.product.prodname_archive %} 常见问题](https://archiveprogram.github.com/faq/)

View File

@@ -0,0 +1,42 @@
---
title: 请求个人帐户数据的存档
redirect_from:
- /articles/requesting-an-archive-of-your-personal-account-s-data
- /articles/requesting-an-archive-of-your-personal-accounts-data
- /github/understanding-how-github-uses-and-protects-your-data/requesting-an-archive-of-your-personal-accounts-data
intro: '{% data reusables.user_settings.export-data %}'
versions:
fpt: '*'
ghec: '*'
topics:
- Policy
- Legal
shortTitle: 请求帐户存档
---
{% data variables.product.product_name %} 存储您个人帐户活动的仓库和个人资料元数据。 您可以通过 {% data variables.product.prodname_dotcom_the_website %} 上的设置或使用用户迁移 API 导出个人帐户的数据。
有关可供导出的数据 {% data variables.product.product_name %} 存储的更多信息,请参阅“[下载用户迁移存档](/rest/reference/migrations#download-a-user-migration-archive)”和“[关于 {% data variables.product.product_name %} 对数据的使用](/articles/about-github-s-use-of-your-data)”。
当您通过 {% data variables.product.prodname_dotcom_the_website %} 上的设置请求导出个人数据时,{% data variables.product.product_name %} 会将您的个人数据打包到 `tar.gz` 文件中,并向您的主电子邮件地址发送含有下载链接的电子邮件。
默认情况下,下载链接会在七天后过期。 在下载链接过期之前的任何时候,您都可以从用户设置中禁用该链接。 更多信息请参阅“[删除对个人帐户数据存档的访问权限](/articles/requesting-an-archive-of-your-personal-account-s-data/#deleting-access-to-an-archive-of-your-personal-accounts-data)”。
如果您的操作系统无法本机解压缩 `tar.gz` 文件,则可以使用第三方工具解压缩存档的文件。 更多信息请参阅 Opensource.com 上的“[如何解压缩 tar.gz 文件](https://opensource.com/article/17/7/how-unzip-targz-file)”。
生成的 `tar.gz` 文件在您开始数据导出时反映存储的数据。
## 下载个人帐户数据的存档
{% data reusables.user_settings.access_settings %}
{% data reusables.user_settings.account_settings %}
3. 在“Export account data导出帐户数据”下单击 **Start export开始导出**或 **New export新导出**。 ![开始个人数据导出按钮突出显示](/assets/images/help/repository/export-personal-data.png) ![新个人数据导出按钮突出显示](/assets/images/help/repository/new-export.png)
4. 导出准备好供下载后,{% data variables.product.product_name %} 将发送下载链接到您的主电子邮件地址。
5. 单击电子邮件中的下载链接并在提示时重新输入密码。
6. 您将被重定向到可以下载的 `tar.gz` 文件。
## 删除个人帐户数据存档的访问权限
{% data reusables.user_settings.access_settings %}
{% data reusables.user_settings.account_settings %}
3. 要在其过期之前禁用发送到您电子邮件的下载链接请在“Export account data导出帐户数据”下找到您想要禁用的数据导出下载然后单击 **Delete删除**。 ![删除个人数据导出包按钮突出显示](/assets/images/help/repository/delete-export-personal-account-data.png)

View File

@@ -135,14 +135,14 @@ These keystrokes are available when the command palette is in navigation and sea
These commands are available from all scopes.
| Command | Behavior |
|:------------------------------------ |:------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `Import repository` | Create a new repository by importing a project from another version control system. For more information, see "[Importing a repository with GitHub importer](/github/importing-your-projects-to-github/importing-source-code-to-github/importing-a-repository-with-github-importer)." |
| `New gist` | Open a new gist. For more information, see "[Creating a gist](/github/writing-on-github/editing-and-sharing-content-with-gists/creating-gists)." |
| `New organization` | Create a new organization. 更多信息请参阅“[从头开始创建新组织](/organizations/collaborating-with-groups-in-organizations/creating-a-new-organization-from-scratch)”。 |
| `新项目` | Create a new project board. For more information, see "[Creating a project](/issues/trying-out-the-new-projects-experience/creating-a-project)." |
| `New repository` | Create a new repository from scratch. 更多信息请参阅“[创建新仓库](/repositories/creating-and-managing-repositories/creating-a-new-repository)”。 |
| `Switch theme to <theme name>` | Change directly to a different theme for the UI. For more information, see "[Managing your theme settings](/account-and-profile/setting-up-and-managing-your-github-user-account/managing-user-account-settings/managing-your-theme-settings)." |
| Command | Behavior |
|:------------------------------------ |:------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `Import repository` | Create a new repository by importing a project from another version control system. For more information, see "[Importing a repository with GitHub importer](/get-started/importing-your-projects-to-github/importing-source-code-to-github/importing-a-repository-with-github-importer)." |
| `New gist` | Open a new gist. For more information, see "[Creating a gist](/get-started/writing-on-github/editing-and-sharing-content-with-gists/creating-gists)." |
| `New organization` | Create a new organization. 更多信息请参阅“[从头开始创建新组织](/organizations/collaborating-with-groups-in-organizations/creating-a-new-organization-from-scratch)”。 |
| `新项目` | Create a new project board. For more information, see "[Creating a project](/issues/trying-out-the-new-projects-experience/creating-a-project)." |
| `New repository` | Create a new repository from scratch. 更多信息请参阅“[创建新仓库](/repositories/creating-and-managing-repositories/creating-a-new-repository)”。 |
| `Switch theme to <theme name>` | Change directly to a different theme for the UI. For more information, see "[Managing your theme settings](/account-and-profile/setting-up-and-managing-your-github-user-account/managing-user-account-settings/managing-your-theme-settings)." |
### Organization commands

View File

@@ -21,10 +21,12 @@ redirect_from:
{% data variables.product.prodname_mobile %} gives you a way to do high-impact work on {% data variables.product.product_name %} quickly and from anywhere. {% data variables.product.prodname_mobile %} is a safe and secure way to access your {% data variables.product.product_name %} data through a trusted, first-party client application.
With {% data variables.product.prodname_mobile %} you can:
- Manage, triage, and clear notifications
- Read, review, and collaborate on issues and pull requests
- Search for, browse, and interact with users, repositories, and organizations
- Receive a push notification when someone mentions your username
{% ifversion fpt or ghec %}- Secure your GitHub.com account with two-factor authentication{% endif %}
For more information about notifications for {% data variables.product.prodname_mobile %}, see "[Configuring notifications](/github/managing-subscriptions-and-notifications-on-github/configuring-notifications#enabling-push-notifications-with-github-mobile)."

View File

@@ -0,0 +1,85 @@
---
title: Creating gists
intro: 'You can create two kinds of gists: {% ifversion ghae %}internal{% else %}public{% endif %} and secret. Create {% ifversion ghae %}an internal{% else %}a public{% endif %} gist if you''re ready to share your ideas with {% ifversion ghae %}enterprise members{% else %}the world{% endif %} or a secret gist if you''re not.'
permissions: '{% data reusables.enterprise-accounts.emu-permission-gist %}'
redirect_from:
- /articles/about-gists
- /articles/cannot-delete-an-anonymous-gist
- /articles/deleting-an-anonymous-gist
- /articles/creating-gists
- /github/writing-on-github/creating-gists
- /github/writing-on-github/editing-and-sharing-content-with-gists/creating-gists
versions:
fpt: '*'
ghes: '*'
ghae: '*'
ghec: '*'
---
## About gists
Every gist is a Git repository, which means that it can be forked and cloned. {% ifversion not ghae %}If you are signed in to {% data variables.product.product_name %} when{% else %}When{% endif %} you create a gist, the gist will be associated with your account and you will see it in your list of gists when you navigate to your {% data variables.gists.gist_homepage %}.
Gists can be {% ifversion ghae %}internal{% else %}public{% endif %} or secret. {% ifversion ghae %}Internal{% else %}Public{% endif %} gists show up in {% data variables.gists.discover_url %}, where {% ifversion ghae %}enterprise members{% else %}people{% endif %} can browse new gists as they're created. They're also searchable, so you can use them if you'd like other people to find and see your work.
Secret gists don't show up in {% data variables.gists.discover_url %} and are not searchable. Secret gists aren't private. If you send the URL of a secret gist to {% ifversion ghae %}another enterprise member{% else %}a friend{% endif %}, they'll be able to see it. However, if {% ifversion ghae %}any other enterprise member{% else %}someone you don't know{% endif %} discovers the URL, they'll also be able to see your gist. If you need to keep your code away from prying eyes, you may want to [create a private repository](/articles/creating-a-new-repository) instead.
{% data reusables.gist.cannot-convert-public-gists-to-secret %}
{% ifversion ghes %}
If your site administrator has disabled private mode, you can also use anonymous gists, which can be public or secret.
{% data reusables.gist.anonymous-gists-cannot-be-deleted %}
{% endif %}
You'll receive a notification when:
- You are the author of a gist.
- Someone mentions you in a gist.
- You subscribe to a gist, by clicking **Subscribe** at the top of any gist.
{% ifversion fpt or ghes or ghec %}
You can pin gists to your profile so other people can see them easily. For more information, see "[Pinning items to your profile](/articles/pinning-items-to-your-profile)."
{% endif %}
You can discover {% ifversion ghae %}internal{% else %}public{% endif %} gists others have created by going to the {% data variables.gists.gist_homepage %} and clicking **All Gists**. This will take you to a page of all gists sorted and displayed by time of creation or update. You can also search gists by language with {% data variables.gists.gist_search_url %}. Gist search uses the same search syntax as [code search](/search-github/searching-on-github/searching-code).
Since gists are Git repositories, you can view their full commit history, complete with diffs. You can also fork or clone gists. For more information, see ["Forking and cloning gists"](/articles/forking-and-cloning-gists).
You can download a ZIP file of a gist by clicking the **Download ZIP** button at the top of the gist. You can embed a gist in any text field that supports Javascript, such as a blog post. To get the embed code, click the clipboard icon next to the **Embed** URL of a gist. To embed a specific gist file, append the **Embed** URL with `?file=FILENAME`.
{% ifversion fpt or ghec %}
Gist supports mapping GeoJSON files. These maps are displayed in embedded gists, so you can easily share and embed maps. For more information, see "[Working with non-code files](/repositories/working-with-files/using-files/working-with-non-code-files#mapping-geojson-files-on-github)."
{% endif %}
## Creating a gist
Follow the steps below to create a gist.
{% ifversion fpt or ghes or ghae or ghec %}
{% note %}
You can also create a gist using the {% data variables.product.prodname_cli %}. For more information, see "[`gh gist create`](https://cli.github.com/manual/gh_gist_create)" in the {% data variables.product.prodname_cli %} documentation.
Alternatively, you can drag and drop a text file from your desktop directly into the editor.
{% endnote %}
{% endif %}
1. Sign in to {% data variables.product.product_name %}.
2. Navigate to your {% data variables.gists.gist_homepage %}.
3. Type an optional description and name for your gist.
![Gist name description](/assets/images/help/gist/gist_name_description.png)
4. Type the text of your gist into the gist text box.
![Gist text box](/assets/images/help/gist/gist_text_box.png)
5. Optionally, to create {% ifversion ghae %}an internal{% else %}a public{% endif %} gist, click {% octicon "triangle-down" aria-label="The downwards triangle icon" %}, then click **Create {% ifversion ghae %}internal{% else %}public{% endif %} gist**.
![Drop-down menu to select gist visibility]{% ifversion ghae %}(/assets/images/help/gist/gist-visibility-drop-down-ae.png){% else %}(/assets/images/help/gist/gist-visibility-drop-down.png){% endif %}
6. Click **Create secret Gist** or **Create {% ifversion ghae %}internal{% else %}public{% endif %} gist**.
![Button to create gist](/assets/images/help/gist/create-secret-gist-button.png)

View File

@@ -0,0 +1,36 @@
---
title: 复刻和克隆 Gist
intro: Gist 实际上是 Git 仓库,这意味着即使您不是原作者,也可以复刻或克隆任何 Gist。 还可以查看 Gist 的完整提交历史记录,包括差异。
permissions: '{% data reusables.enterprise-accounts.emu-permission-gist %}'
redirect_from:
- /articles/forking-and-cloning-gists
- /github/writing-on-github/forking-and-cloning-gists
- /github/writing-on-github/editing-and-sharing-content-with-gists/forking-and-cloning-gists
versions:
fpt: '*'
ghes: '*'
ghae: '*'
ghec: '*'
---
## 复刻 Gist
每个 Gist 都指示哪些复刻中有活动,使您更容易找到他人的有趣更改。
![Gist 复刻](/assets/images/help/gist/gist_forks.png)
## 克隆 Gist
如果要对 Gist 进行本地更改然后将其推送到 web 上,您可以克隆 Gist 然后进行提交,与使用任何 Git 仓库的方法一样。 更多信息请参阅“[克隆仓库](/articles/cloning-a-repository)”。
![Gist 克隆按钮](/assets/images/help/gist/gist_clone_btn.png)
## 查看 Gist 提交历史记录
To view a gist's full commit history, click the "Revisions" tab at the top of the gist.
![Gist 版本选项卡](/assets/images/help/gist/gist_revisions_tab.png)
您将看到该 Gist 的完整提交历史记录及其差异。
![Gist 版本页面](/assets/images/help/gist/gist_history.png)

View File

@@ -0,0 +1,19 @@
---
title: 编辑内容以及与 gist 共享内容
intro: ''
redirect_from:
- /categories/23/articles
- /categories/gists
- /articles/editing-and-sharing-content-with-gists
- /github/writing-on-github/editing-and-sharing-content-with-gists
versions:
fpt: '*'
ghes: '*'
ghae: '*'
ghec: '*'
children:
- /creating-gists
- /forking-and-cloning-gists
shortTitle: 与 gists 共享内容
---

View File

@@ -0,0 +1,45 @@
---
title: 关于在 GitHub 上编写和设置格式
intro: GitHub 结合了用于格式化文字的语法,称为 GitHub Flavored Markdown具有一些独特的写作功能。
redirect_from:
- /articles/about-writing-and-formatting-on-github
- /github/writing-on-github/about-writing-and-formatting-on-github
- /github/writing-on-github/getting-started-with-writing-and-formatting-on-github/about-writing-and-formatting-on-github
versions:
fpt: '*'
ghes: '*'
ghae: '*'
ghec: '*'
shortTitle: 在 GitHub 上编写和格式化
---
[Markdown](http://daringfireball.net/projects/markdown/) 是一种易于阅读和编写的语法,用于格式化纯文本。
我们添加了一些自定义功能来创建 {% data variables.product.prodname_dotcom %} Flavored Markdown用于格式化网站中的散文和代码。
您也可以在拉取请求和议题中使用 [@提及](/articles/basic-writing-and-formatting-syntax/#mentioning-people-and-teams)、[议题和 PR 参考](/articles/basic-writing-and-formatting-syntax/#referencing-issues-and-pull-requests)和[表情符号](/articles/basic-writing-and-formatting-syntax/#using-emoji)等功能与其他用户交互。
## 文本格式工具栏
{% data variables.product.product_name %} 上的每个评论字段都包含文本格式工具栏,用于格式化文本,而无需了解 Markdown 语法。 除了 Markdown 格式(如粗体和斜体样式)和创建标题、链接及列表等之外,工具栏还包括 {% data variables.product.product_name %} 特定的功能,如 @提及、任务列表以及链接到议题和拉取请求。
{% if fixed-width-font-gfm-fields %}
## Enabling fixed-width fonts in the editor
You can enable a fixed-width font in every comment field on {% data variables.product.product_name %}. Each character in a fixed-width, or monospace, font occupies the same horizontal space which can make it easier to edit advanced Markdown structures such as tables and code snippets.
![Screenshot showing the {% data variables.product.product_name %} comment field with fixed-width fonts enabled](/assets/images/help/writing/fixed-width-example.png)
{% data reusables.user_settings.access_settings %}
{% data reusables.user_settings.appearance-settings %}
1. Under "Markdown editor font preference", select **Use a fixed-width (monospace) font when editing Markdown**. ![Screenshot showing the {% data variables.product.product_name %} comment field with fixed width fonts enabled](/assets/images/help/writing/enable-fixed-width.png)
{% endif %}
## 延伸阅读
- [{% data variables.product.prodname_dotcom %} Flavored Markdown 规格](https://github.github.com/gfm/)
- "[基本撰写和格式语法](/articles/basic-writing-and-formatting-syntax)"
- "[使用高级格式](/articles/working-with-advanced-formatting)"
- "[熟悉 Markdown](https://guides.github.com/features/mastering-markdown/)"

View File

@@ -0,0 +1,344 @@
---
title: 基本撰写和格式语法
intro: 使用简单的语法在 GitHub 上为您的散文和代码创建复杂的格式。
redirect_from:
- /articles/basic-writing-and-formatting-syntax
- /github/writing-on-github/basic-writing-and-formatting-syntax
- /github/writing-on-github/getting-started-with-writing-and-formatting-on-github/basic-writing-and-formatting-syntax
versions:
fpt: '*'
ghes: '*'
ghae: '*'
ghec: '*'
shortTitle: 基本格式语法
---
## 标题
要创建标题,请在标题文本前添加一至六个 <kbd>#</kbd> 符号。 您使用的 <kbd>#</kbd> 数量将决定标题的大小。
```markdown
# 最大标题
## 第二大标题
###### 最小标题
```
![渲染的 H1、H2 和 H6 标题](/assets/images/help/writing/headings-rendered.png)
## 样式文本
您可以在评论字段和 `.md` 文件中以粗体、斜体或删除线的文字表示强调。
| 样式 | 语法 | 键盘快捷键 | 示例 | 输出 |
| -------- | ------------------ | ------------------------------------------------------------------------------------- | ------------------ | ---------------- |
| 粗体 | `** **``__ __` | <kbd>Command</kbd>+<kbd>B</kbd> (Mac) or <kbd>Ctrl</kbd>+<kbd>B</kbd> (Windows/Linux) | `**这是粗体文本**` | **这是粗体文本** |
| 斜体 | `* *``_ _` | <kbd>Command</kbd>+<kbd>I</kbd> (Mac) or <kbd>Ctrl</kbd>+<kbd>I</kbd> (Windows/Linux) | `*这是斜体文本*` | *这是斜体文本* |
| 删除线 | `~~ ~~` | | `~~这是错误文本~~` | ~~这是错误文本~~ |
| 粗体和嵌入的斜体 | `** **``_ _` | | `**此文本 _非常_ 重要**` | **此文本_非常_重要** |
| 全部粗体和斜体 | `*** ***` | | `***所有这些文本都很重要***` | ***所有这些文本都是斜体*** |
## 引用文本
You can quote text with a <kbd>></kbd>.
```markdown
Text that is not a quote
> Text that is a quote
```
![渲染的引用文本](/assets/images/help/writing/quoted-text-rendered.png)
{% tip %}
**Tip:** When viewing a conversation, you can automatically quote text in a comment by highlighting the text, then typing <kbd>R</kbd>. 您可以单击 {% octicon "kebab-horizontal" aria-label="The horizontal kebab icon" %} 和 **Quote reply引用回复**引用整个评论。 有关键盘快捷键的更多信息,请参阅“[键盘快捷键](/articles/keyboard-shortcuts/)”。
{% endtip %}
## 引用代码
使用单反引号可标注句子中的代码或命令。 The text within the backticks will not be formatted.{% ifversion fpt or ghae or ghes > 3.1 or ghec %} You can also press the <kbd>Command</kbd>+<kbd>E</kbd> (Mac) or <kbd>Ctrl</kbd>+<kbd>E</kbd> (Windows/Linux) keyboard shortcut to insert the backticks for a code block within a line of Markdown.{% endif %}
```markdown
使用 `git status` 列出尚未提交的所有新文件或已修改文件。
```
![渲染的内联代码块](/assets/images/help/writing/inline-code-rendered.png)
要将代码或文本格式化为各自的不同块,请使用三反引号。
<pre>
一些基本的 Git 命令为:
```
git status
git add
git commit
```
</pre>
![渲染的代码块](/assets/images/help/writing/code-block-rendered.png)
更多信息请参阅“[创建和突出显示代码块](/articles/creating-and-highlighting-code-blocks)”。
{% data reusables.user_settings.enabling-fixed-width-fonts %}
## 链接
通过将链接文本包含在方括号 `[ ]` 内,然后将 URL 包含在括号 `( )` 内,可创建内联链接。 {% ifversion fpt or ghae or ghes > 3.1 or ghec %}You can also use the keyboard shortcut <kbd>Command</kbd>+<kbd>K</kbd> to create a link.{% endif %}{% ifversion fpt or ghae-issue-5434 or ghes > 3.3 or ghec %} When you have text selected, you can paste a URL from your clipboard to automatically create a link from the selection.{% endif %}
`本站点是使用 [GitHub Pages](https://pages.github.com/) 构建的。`
![渲染的链接](/assets/images/help/writing/link-rendered.png)
{% tip %}
**提示:**当评论中写入了有效 URL 时,{% data variables.product.product_name %} 会自动创建链接。 更多信息请参阅“[自动链接的引用和 URL](/articles/autolinked-references-and-urls)”。
{% endtip %}
## 章节链接
{% data reusables.repositories.section-links %}
## 相对链接
{% data reusables.repositories.relative-links %}
## 图像
You can display an image by adding <kbd>!</kbd> and wrapping the alt text in `[ ]`. 然后将图像链接包装在括号 `()` 中。
`![This is an image](https://myoctocat.com/assets/images/base-octocat.svg)`
![渲染的图像](/assets/images/help/writing/image-rendered.png)
{% data variables.product.product_name %} 支持将图像嵌入到您的议题、拉取请求{% ifversion fpt or ghec %}、讨论{% endif %}、评论和 `.md` 文件中。 您可以从仓库显示图像、添加在线图像链接或上传图像。 更多信息请参阅“[上传资产](#uploading-assets)”。
{% tip %}
**提示:**想要显示仓库中的图像时,应该使用相对链接而不是绝对链接。
{% endtip %}
下面是一些使用相对链接显示图像的示例。
| 上下文 | 相对链接 |
| ------------------ | ---------------------------------------------------------------------- |
| 在同一个分支上的 `.md` 文件中 | `/assets/images/electrocat.png` |
| 在另一个分支的 `.md` 文件中 | `/../main/assets/images/electrocat.png` |
| 在仓库的议题、拉取请求和评论中 | `../blob/main/assets/images/electrocat.png` |
| 在另一个仓库的 `.md` 文件中 | `/../../../../github/docs/blob/main/assets/images/electrocat.png` |
| 在另一个仓库的议题、拉取请求和评论中 | `../../../github/docs/blob/main/assets/images/electrocat.png?raw=true` |
{% note %}
**注意**:上表中的最后两个相对链接只有在查看者至少能够读取包含这些图像的私有仓库时,才可用于私有仓库中的图像。
{% endnote %}
更多信息请参阅“[相对链接](#relative-links)”。
{% ifversion fpt or ghec or ghes > 3.3 or ghae-issue-5559 %}
### Specifying the theme an image is shown to
You can specify the theme an image is displayed to by appending `#gh-dark-mode-only` or `#gh-light-mode-only` to the end of an image URL, in Markdown.
We distinguish between light and dark color modes, so there are two options available. You can use these options to display images optimized for dark or light backgrounds. This is particularly helpful for transparent PNG images.
| 上下文 | URL |
| ----------- | ------------------------------------------------------------------------ |
| Dark Theme | `![GitHub Light](https://github.com/github-light.png#gh-dark-mode-only)` |
| Light Theme | `![GitHub Dark](https://github.com/github-dark.png#gh-light-mode-only)` |
{% endif %}
## 列表
通过在一行或多行文本前面添加 <kbd>-</kbd> 或 <kbd>*</kbd> 可创建无序列表。
```markdown
- George Washington
- John Adams
- Thomas Jefferson
```
![渲染的无序列表](/assets/images/help/writing/unordered-list-rendered.png)
要对列表排序,请在每行前面添加一个编号。
```markdown
1. James Madison
2. James Monroe
3. John Quincy Adams
```
![渲染的有序列表](/assets/images/help/writing/ordered-list-rendered.png)
### 嵌套列表
通过在一个列表项下面缩进一个或多个其他列表项,可创建嵌套列表。
要通过 {% data variables.product.product_name %} 上的 web 编辑器或使用等宽字体的文本编辑器(例如 [Atom](https://atom.io/))创建嵌套列表,您可以直观地对齐列表。 在嵌套列表项的前面键入空格字符,直至列表标记字符(<kbd>-</kbd> 或 <kbd>*</kbd>)位于其上方条目中第一个文本字符的正下方。
```markdown
1. 第一个列表项
- 第一个嵌套列表项
- 第二个嵌套列表项
```
![突出显示对齐的嵌套列表](/assets/images/help/writing/nested-list-alignment.png)
![含两级嵌套项的列表](/assets/images/help/writing/nested-list-example-1.png)
要在 {% data variables.product.product_name %} 上的评论编辑器中创建嵌套列表(不使用等宽字体),您可以查看嵌套列表正上方的列表项,并计算该条目内容前面的字符数量。 然后在嵌套列表项的前面键入该数量的空格字符。
在此例中,您可以通过缩进嵌套列表项至少五个空格,在列表项 `100. 第一个列表项`的下面添加一个嵌套列表项,因为在`第一个列表项`的前面有五个字符 (`100.`) 。
```markdown
100. 第一个列表项
- 第一个嵌套列表项
```
![含一个嵌套列表项的列表](/assets/images/help/writing/nested-list-example-3.png)
您可以使用相同的方法创建多层级嵌套列表。 例如,由于在第一个嵌套列表项中,嵌套列表项内容`第一个嵌套列表项`之前有七个字符 (`␣␣␣␣␣-␣`),因此需要将第二个嵌套列表项缩进七个空格。
```markdown
100. 第一个列表项
- 第一个嵌套列表项
- 第二个嵌套列表项
```
![含两级嵌套项的列表](/assets/images/help/writing/nested-list-example-2.png)
更多示例请参阅 [GitHub Flavored Markdown 规范](https://github.github.com/gfm/#example-265)。
## 任务列表
{% data reusables.repositories.task-list-markdown %}
If a task list item description begins with a parenthesis, you'll need to escape it with <kbd>\\</kbd>:
`- [ ] \(Optional) 打开后续议题`
更多信息请参阅“[关于任务列表](/articles/about-task-lists)”。
## 提及人员和团队
您可以在 {% data variables.product.product_name %} 上提及人员或[团队](/articles/setting-up-teams/),方法是键入 <kbd>@</kbd> 加上其用户名或团队名称。 这将触发通知并提请他们注意对话。 如果您在编辑的评论中提及某人的用户名或团队名称,该用户也会收到通知。 有关通知的更多信息,请参阅{% ifversion fpt or ghes or ghae or ghec %}"[关于通知](/github/managing-subscriptions-and-notifications-on-github/about-notifications){% else %}“[关于通知](/github/receiving-notifications-about-activity-on-github/about-notifications){% endif %}”。
`@github/support 您如何看待这些更新?`
![渲染的 @提及](/assets/images/help/writing/mention-rendered.png)
当您提及父团队时,其子团队的成员也会收到通知,这简化了与多个人员团队的沟通。 更多信息请参阅“[关于团队](/articles/about-teams)”。
键入 <kbd>@</kbd> 符号将显示项目中的人员或团队列表。 列表会在您键入时进行过滤,因此一旦找到所需人员或团队的名称,您可以使用箭头键选择它,然后按 Tab 或 Enter 键以填写名称。 提及团队时,请输入 @组织/团队名称,该团队的所有成员将收到关注对话的提醒。
自动填写结果仅限于仓库协作者和该线程上的任何其他参与者。
## 引用议题和拉取请求
通过键入 <kbd>#</kbd> 可显示仓库中建议的议题和拉取请求列表。 键入议题或拉取请求的编号或标题以过滤列表,然后按 Tab 或 Enter 键以填写选中的结果。
更多信息请参阅“[自动链接的引用和 URL](/articles/autolinked-references-and-urls)”。
## 引用外部资源
{% data reusables.repositories.autolink-references %}
{% ifversion ghes < 3.4 %}
## 内容附件
有些 {% data variables.product.prodname_github_apps %} 在 {% data variables.product.product_name %} 中提供链接到其注册域名的 URL 信息。 {% data variables.product.product_name %} 可渲染应用程序在正文或者议题或拉取请求的评论中的 URL 下提供的信息。
![内容附件](/assets/images/github-apps/content_reference_attachment.png)
要查看内容附件,您必须拥有使用仓库中安装的内容附件 API 的 {% data variables.product.prodname_github_app %}。{% ifversion fpt or ghec %} 更多信息请参阅“[在个人帐户中安装应用程序](/articles/installing-an-app-in-your-personal-account)”和“[在组织中安装应用程序](/articles/installing-an-app-in-your-organization)”。{% endif %}
内容附件不会显示在属于 markdown 链接的 URL 中。
For more information about building a {% data variables.product.prodname_github_app %} that uses content attachments, see "[Using Content Attachments](/apps/using-content-attachments)."{% endif %}
## 上传资产
您可以通过拖放、从文件浏览器中选择或粘贴来上传图像等资产。 您可以将资产上传到议题、拉取请求、评论和仓库中的 `.md` 文件。
## 使用表情符号
通过键入 `:EMOJICODE:` 可在您的写作中添加表情符号。
`@octocat :+1: 这个 PR 看起来很棒 - 可以合并了! :shipit:`
![渲染的表情符号](/assets/images/help/writing/emoji-rendered.png)
键入 <kbd>:</kbd> 将显示建议的表情符号列表。 列表将在您键入时进行过滤,因此一旦找到所需表情符号,请按 **Tab****Enter** 键以填写选中的结果。
有关可用表情符号和代码的完整列表,请查看[表情符号备忘清单](https://github.com/ikatyang/emoji-cheat-sheet/blob/master/README.md)。
## 段落
通过在文本行之间留一个空白行,可创建新段落。
{% ifversion fpt or ghae-issue-5180 or ghes > 3.2 or ghec %}
## 脚注
您可以使用此括号语法为您的内容添加脚注:
```
Here is a simple footnote[^1].
A footnote can also have multiple lines[^2].
You can also use words, to fit your writing style more closely[^note].
[^1]: My reference.
[^2]: Every new line should be prefixed with 2 spaces.
This allows you to have a footnote with multiple lines.
[^note]:
Named footnotes will still render with numbers instead of the text but allow easier identification and linking.
This footnote also has been made with a different syntax using 4 spaces for new lines.
```
脚注将呈现如下:
![渲染的脚注](/assets/images/site/rendered-footnote.png)
{% tip %}
**注意**Markdown 中脚注的位置不会影响该脚注的呈现位置。 您可以在引用脚注后立即写脚注,脚注仍将呈现在 Markdown 的底部。
{% endtip %}
{% endif %}
## 隐藏有评论的内容
您可以通过在 HTML 评论中加入内容来指示 {% data variables.product.product_name %} 隐藏渲染的 Markdown 中的内容。
<pre>
&lt;!-- This content will not appear in the rendered Markdown --&gt;
</pre>
## 忽略 Markdown 格式
You can tell {% data variables.product.product_name %} to ignore (or escape) Markdown formatting by using <kbd>\\</kbd> before the Markdown character.
`让我们将 \*our-new-project\* 重命名为 \*our-old-project\*。`
![渲染的规避字符](/assets/images/help/writing/escaped-character-rendered.png)
更多信息请参阅 Daring Fireball 的“[Markdown 语法](https://daringfireball.net/projects/markdown/syntax#backslash)”。
{% ifversion fpt or ghes > 3.2 or ghae-issue-5232 or ghec %}
## 禁用 Markdown 渲染
{% data reusables.repositories.disabling-markdown-rendering %}
{% endif %}
## 延伸阅读
- [{% data variables.product.prodname_dotcom %} Flavored Markdown 规格](https://github.github.com/gfm/)
- “[关于 GitHub 上的撰写和格式](/articles/about-writing-and-formatting-on-github)”
- "[使用高级格式](/articles/working-with-advanced-formatting)"
- "[熟悉 Markdown](https://guides.github.com/features/mastering-markdown/)"

View File

@@ -0,0 +1,19 @@
---
title: 开始在 GitHub 上编写和格式化
redirect_from:
- /articles/markdown-basics
- /articles/things-you-can-do-in-a-text-area-on-github
- /articles/getting-started-with-writing-and-formatting-on-github
- /github/writing-on-github/getting-started-with-writing-and-formatting-on-github
intro: 您可以在 GitHub 上使用简单的功能格式化您的评论,与他人交流议题、拉取请求和 wiki。
versions:
fpt: '*'
ghes: '*'
ghae: '*'
ghec: '*'
children:
- /about-writing-and-formatting-on-github
- /basic-writing-and-formatting-syntax
shortTitle: 开始在 GitHub 上写入
---

View File

@@ -0,0 +1,21 @@
---
title: 在 GitHub 上编写
redirect_from:
- /categories/88/articles
- /articles/github-flavored-markdown
- /articles/writing-on-github
- /categories/writing-on-github
- /github/writing-on-github
intro: '您可以通过各种格式选项构建 {% data variables.product.product_name %} 共享的信息。'
versions:
fpt: '*'
ghes: '*'
ghae: '*'
ghec: '*'
children:
- /getting-started-with-writing-and-formatting-on-github
- /working-with-advanced-formatting
- /working-with-saved-replies
- /editing-and-sharing-content-with-gists
---

View File

@@ -0,0 +1,64 @@
---
title: 附加文件
intro: 您可以通过将各种文件类型附加到议题和拉取请求来传达信息。
redirect_from:
- /github/managing-your-work-on-github/managing-your-work-with-issues-and-pull-requests/file-attachments-on-issues-and-pull-requests
- /articles/issue-attachments
- /articles/file-attachments-on-issues-and-pull-requests
- /github/managing-your-work-on-github/file-attachments-on-issues-and-pull-requests
- /github/writing-on-github/working-with-advanced-formatting/attaching-files
versions:
fpt: '*'
ghes: '*'
ghae: '*'
ghec: '*'
topics:
- Pull requests
---
{% warning %}
**Warning:** If you add an image{% ifversion fpt or ghes > 3.1 or ghae or ghec %} or video{% endif %} to a pull request or issue comment, anyone can view the anonymized URL without authentication, even if the pull request is in a private repository{% ifversion ghes %}, or if private mode is enabled{% endif %}. 要对敏感媒体文件保密,请从需要身份验证的私有网络或服务器提供它们。 {% ifversion fpt or ghec %}有关匿名 URL 的更多信息,请参阅“[关于匿名 URL](/github/authenticating-to-github/about-anonymized-urls)”。{% endif %}
{% endwarning %}
要将文件附加到议题或拉取请求对话,请将它拖放到评论框中。 或者,您也可以单击评论框底部的栏来浏览、选择和添加计算机中的文件。
![从计算机选择附件](/assets/images/help/pull_requests/select-bar.png)
{% tip %}
**提示:**在许多浏览器中,您可以将图像直接复制并粘贴到该框中。
{% endtip %}
最大文件大小为:
- 10MB for images and gifs{% ifversion fpt or ghec %}
- 10MB对于上传到使用免费 GitHub 计划的用户或组织所拥有仓库的视频
- 100MB对于上传到使用付费 GitHub 计划的用户或组织所拥有仓库的视频{% elsif fpt or ghes > 3.1 or ghae %}
- 100MB for videos{% endif %}
- 25MB对于所有其他文件
我们支持这些文件:
* PNG (*.png*)
* GIF (*.gif*)
* JPEG (*.jpg*)
{%- if svg-support %}
* SVG (*.svg*)
{%- endif %}
* 日志文件 (*.log*)
* Microsoft Word (*.docx*)、Powerpoint (*.pptx*) 和 Excel (*.xlsx*) 文档
* 文本文件 (*.txt*)
* PDF (*.pdf*)
* ZIP*.zip*、*.gz*{% ifversion fpt or ghes > 3.1 or ghae or ghec %}
* 视频(*.mp4*、*.mov*
{% note %}
**注意:** 视频编解码器兼容性是浏览器特定的,上传到一个浏览器的视频可能无法在另一个浏览器上查看。 目前,我们建议使用 h.264 实现最大兼容性。
{% endnote %}
{% endif %}
![附件动画 GIF](/assets/images/help/pull_requests/dragging_images.gif)

View File

@@ -0,0 +1,65 @@
---
title: 自动链接的引用和 URL
intro: 对 URL、议题、拉取请求和提交的引用会自动缩短并转换为链接。
redirect_from:
- /articles/autolinked-references-and-urls
- /github/writing-on-github/autolinked-references-and-urls
- /github/writing-on-github/working-with-advanced-formatting/autolinked-references-and-urls
versions:
fpt: '*'
ghes: '*'
ghae: '*'
ghec: '*'
shortTitle: 自动链接的引用
---
## URL
{% data variables.product.product_name %} 自动从标准 URL 创建链接。
`访问 https://github.com`
![显示的自动链接的 URL](/assets/images/help/writing/url-autolink-rendered.png)
有关创建链接的更多信息,请参阅“[基本撰写和格式语法](/articles/basic-writing-and-formatting-syntax/#links)”。
## 议题和拉取请求
在 {% data variables.product.product_name %} 上的对话中,对议题和拉取请求的引用将自动转换为缩短的链接。
{% note %}
**注:**在仓库的 wiki 或文件中无法创建自动链接的引用。
{% endnote %}
| 引用类型 | 源引用 | 短链接 |
| ------------------------------------------ | ---------------------------------------------- | ---------------------------------------------------------------------- |
| 议题或拉取请求 URL | https://github.com/jlord/sheetsee.js/issues/26 | [#26](https://github.com/jlord/sheetsee.js/issues/26) |
| `#` 和议题或拉取请求编号 | #26 | [#26](https://github.com/jlord/sheetsee.js/issues/26) |
| `GH-` 和议题或拉取请求编号 | GH-26 | [GH-26](https://github.com/jlord/sheetsee.js/issues/26) |
| `Username/Repository#` 和议题或拉取请求编号 | jlord/sheetsee.js#26 | [jlord/sheetsee.js#26](https://github.com/jlord/sheetsee.js/issues/26) |
| `Organization_name/Repository#` 和议题或拉取请求编号 | github/linguist#4039 | [github/linguist#4039](https://github.com/github/linguist/pull/4039) |
{% ifversion fpt or ghec %}
如果您在列表中引用议题、拉取请求或讨论,则引用将展开以显示标题和状态。 有关任务列表的更多信息,请参阅“[关于任务列表](/issues/tracking-your-work-with-issues/creating-issues/about-task-lists)”。
{% endif %}
## 提交 SHA
对提交 SHA 哈希的引用会自动转换为指向 {% data variables.product.product_name %} 上提交的短链接。
| 引用类型 | 源引用 | 短链接 |
| ------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------- |
| 提交 URL | [`https://github.com/jlord/sheetsee.js/commit/a5c3785ed8d6a35868bc169f07e40e889087fd2e`](https://github.com/jlord/sheetsee.js/commit/a5c3785ed8d6a35868bc169f07e40e889087fd2e) | [a5c3785](https://github.com/jlord/sheetsee.js/commit/a5c3785ed8d6a35868bc169f07e40e889087fd2e) |
| SHA | a5c3785ed8d6a35868bc169f07e40e889087fd2e | [a5c3785](https://github.com/jlord/sheetsee.js/commit/a5c3785ed8d6a35868bc169f07e40e889087fd2e) |
| User@SHA | jlord@a5c3785ed8d6a35868bc169f07e40e889087fd2e | [jlord@a5c3785](https://github.com/jlord/sheetsee.js/commit/a5c3785ed8d6a35868bc169f07e40e889087fd2e) |
| `Username/Repository@SHA` | `jlord/sheetsee.js@a5c3785ed8d6a35868bc169f07e40e889087fd2e` | [`jlord/sheetsee.js@a5c3785`](https://github.com/jlord/sheetsee.js/commit/a5c3785ed8d6a35868bc169f07e40e889087fd2e) |
## 自定义外部资源的自动链接
{% data reusables.repositories.autolink-references %}
## 延伸阅读
- "[基本撰写和格式语法](/articles/basic-writing-and-formatting-syntax)"

View File

@@ -0,0 +1,50 @@
---
title: 创建指向代码段的永久链接
intro: 您可以创建指向特定版本的文件或拉取请求中特定代码行或行范围的永久链接。
redirect_from:
- /github/managing-your-work-on-github/managing-your-work-with-issues-and-pull-requests/creating-a-permanent-link-to-a-code-snippet
- /articles/creating-a-permanent-link-to-a-code-snippet
- /github/managing-your-work-on-github/creating-a-permanent-link-to-a-code-snippet
- /github/writing-on-github/working-with-advanced-formatting/creating-a-permanent-link-to-a-code-snippet
versions:
fpt: '*'
ghes: '*'
ghae: '*'
ghec: '*'
topics:
- Pull requests
shortTitle: 代码的永久链接
---
## 链接到代码
此类永久链接仅在其起源仓库中呈现为代码段。 在其他仓库中,永久链接代码段将呈现为 URL。
![评论中呈现的代码段](/assets/images/help/repository/rendered-code-snippet.png)
{% tip %}
**提示:**要创建整个文件的永久链接,请参阅“[获取文件的永久链接](/articles/getting-permanent-links-to-files)”。
{% endtip %}
{% data reusables.repositories.navigate-to-repo %}
2. 找到要链接的代码:
- 要链接到文件中的代码,请导航到该文件。
- 要链接到拉取请求中的代码,请导航到该拉取请求并单击 {% octicon "diff" aria-label="The file diff icon" %} **Files changed已更改文件**。 然后浏览到含有要包含在评论中的代码的文件,并单击 **View查看**
{% data reusables.repositories.choose-line-or-range %}
4. 在代码行或行范围的左侧,单击 {% octicon "kebab-horizontal" aria-label="The horizontal kebab octicon" %}。 在下拉菜单中,单击 **Copy permalink复制永久链接**。 ![可选择复制所选行的永久链接的 Kebab 菜单](/assets/images/help/repository/copy-permalink-specific-line.png)
5. 导航到要链接到代码段的对话。
6. 将永久链接粘贴到评论中,然后单击 **Comment评论**。 ![粘贴在同一个仓库的评论中的永久链接](/assets/images/help/repository/code-snippet-permalink-in-comment.png)
## 链接到 Markdown
您可以通过加载 Markdown 文件而不进行 Markdown 渲染来链接到 Markdown 文件中的特定行。 要在不渲染的情况下加载 Markdown 文件,您可以在文件的 url 末尾使用 `?plain=1` 参数。 例如 `github.com/<organization>/<repository>/blob/<branch_name>/README.md?plain=1`
您可以在代码中以同样的方式链接到 Markdown 文件中的特定行。 在 url 末尾的行号附加 `#L`。 例如,`github.com/<organization>/<repository>/blob/<branch_name>/README.md?plain=1#L14` 将在纯文本文件 README.md 中突出显示第 14 行。
## 延伸阅读
- “[创建议题](/articles/creating-an-issue/)”
- “[从代码打开议题](/articles/opening-an-issue-from-code/)”
- “[审查拉取请求中的更改](/articles/reviewing-changes-in-pull-requests/)”

View File

@@ -0,0 +1,73 @@
---
title: 创建和突显代码块
intro: 通过围栏代码块和启用语法突显来分享代码样本
redirect_from:
- /articles/creating-and-highlighting-code-blocks
- /github/writing-on-github/creating-and-highlighting-code-blocks
- /github/writing-on-github/working-with-advanced-formatting/creating-and-highlighting-code-blocks
versions:
fpt: '*'
ghes: '*'
ghae: '*'
ghec: '*'
shortTitle: 创建代码块
---
## 围栏代码块
通过在代码块的前后输入三反引号 <code>\`\`\`</code>,可创建围栏代码块。 我们建议在代码块的前后各留一个空白行,使原始格式更易辨读。
<pre>
```
function test() {
console.log("notice the blank line before this function?");
}
```
</pre>
![渲染的围栏代码块](/assets/images/help/writing/fenced-code-block-rendered.png)
{% tip %}
**提示:**要在列表中保留格式,请确保将非围栏代码块缩进八个空格。
{% endtip %}
要在围栏代码块中显示三重倒引号,请将其包在四个倒引号内。
<pre>
````
```
Look! You can see my backticks.
```
````
</pre>
![使用倒引号块呈现的围栏代码](/assets/images/help/writing/fenced-code-show-backticks-rendered.png)
{% data reusables.user_settings.enabling-fixed-width-fonts %}
## 语法突显
<!-- If you make changes to this feature, update /getting-started-with-github/github-language-support to reflect any changes to supported languages. -->
您可以添加可选的语言标识符,以在围栏代码块中启用语法突显。
例如,要语法突显 Ruby 代码:
```ruby
require 'redcarpet'
markdown = Redcarpet.new("Hello World!")
puts markdown.to_html
puts markdown.to_html
```
![渲染的启用 Ruby 语法突显的代码块](/assets/images/help/writing/code-block-syntax-highlighting-rendered.png)
我们使用 [Linguist](https://github.com/github/linguist) 来执行语言检测并选择[第三方语法](https://github.com/github/linguist/blob/master/vendor/README.md)进行语法突显。 您可以在[语言 YAML 文件](https://github.com/github/linguist/blob/master/lib/linguist/languages.yml)中找出哪些关键词有效。
## 延伸阅读
- [{% data variables.product.prodname_dotcom %} Flavored Markdown 规格](https://github.github.com/gfm/)
- "[基本撰写和格式语法](/articles/basic-writing-and-formatting-syntax)"

View File

@@ -0,0 +1,22 @@
---
title: 使用高级格式
intro: 表格、语法突出显示和自动链接等格式设置可让您在拉取请求、议题和评论中清楚地布置复杂的信息。
redirect_from:
- /articles/working-with-advanced-formatting
- /github/writing-on-github/working-with-advanced-formatting
versions:
fpt: '*'
ghes: '*'
ghae: '*'
ghec: '*'
children:
- /organizing-information-with-tables
- /organizing-information-with-collapsed-sections
- /creating-and-highlighting-code-blocks
- /autolinked-references-and-urls
- /attaching-files
- /creating-a-permanent-link-to-a-code-snippet
- /using-keywords-in-issues-and-pull-requests
shortTitle: 使用高级格式
---

View File

@@ -0,0 +1,43 @@
---
title: Organizing information with collapsed sections
intro: You can streamline your Markdown by creating a collapsed section with the `<details>` tag.
versions:
fpt: '*'
ghes: '*'
ghae: '*'
ghec: '*'
redirect_from:
- /github/writing-on-github/working-with-advanced-formatting/organizing-information-with-collapsed-sections
shortTitle: Collapsed sections
---
## Creating a collapsed section
You can temporarily obscure sections of your Markdown by creating a collapsed section that the reader can choose to expand. For example, when you want to include technical details in an issue comment that may not be relevant or interesting to every reader, you can put those details in a collapsed section.
Any Markdown within the `<details>` block will be collapsed until the reader clicks {% octicon "triangle-right" aria-label="The right triange icon" %} to expand the details. Within the `<details>` block, use the `<summary>` tag to create a label to the right of {% octicon "triangle-right" aria-label="The right triange icon" %}.
```markdown
<details><summary>CLICK ME</summary>
<p>
#### We can hide anything, even code!
```ruby
puts "Hello World"
```
</details> ```</p>
The Markdown will be collapsed by default.
![Rendered collapsed](/assets/images/help/writing/collapsed-section-view.png)
After a reader clicks {% octicon "triangle-right" aria-label="The right triange icon" %}, the details are expanded.
![Rendered open](/assets/images/help/writing/open-collapsed-section.png)
## 延伸阅读
- [{% data variables.product.prodname_dotcom %} Flavored Markdown 规格](https://github.github.com/gfm/)
- "[基本撰写和格式语法](/articles/basic-writing-and-formatting-syntax)"

View File

@@ -0,0 +1,83 @@
---
title: 使用表格组织信息
intro: 您可以创建表格来组织评论、议题、拉取请求和 wiki 中的信息。
redirect_from:
- /articles/organizing-information-with-tables
- /github/writing-on-github/organizing-information-with-tables
- /github/writing-on-github/working-with-advanced-formatting/organizing-information-with-tables
versions:
fpt: '*'
ghes: '*'
ghae: '*'
ghec: '*'
shortTitle: 使用表格组织的数据
---
## 创建表格
您可以用竖线 `|` 和横线 `-` 创建表格。 横线用于创建每列的标题,而竖线用于分隔每列。 必须在表格前包含空白链接,以便其正确呈现。
```markdown
| First Header | Second Header |
| ------------- | ------------- |
| Content Cell | Content Cell |
| Content Cell | Content Cell |
```
![呈现的表格](/assets/images/help/writing/table-basic-rendered.png)
表格末尾的竖线可选。
单元格的宽度可以不同,无需在列内准确对齐。 标题行的第一列中必须至少有三个横线。
```markdown
| Command | Description |
| --- | --- |
| git status | List all new or modified files |
| git diff | Show file differences that haven't been staged |
```
![呈现的单元格宽度不同的表格](/assets/images/help/writing/table-varied-columns-rendered.png)
{% data reusables.user_settings.enabling-fixed-width-fonts %}
## 格式化表格中的内容
您可以在表格中使用[格式](/articles/basic-writing-and-formatting-syntax),如链接、内联代码块和文本样式:
```markdown
| Command | Description |
| --- | --- |
| `git status` | List all *new or modified* files |
| `git diff` | Show file differences that **haven't been** staged |
```
![呈现的带格式化文本的表格](/assets/images/help/writing/table-inline-formatting-rendered.png)
您可以在标头行中横线的左侧、右侧或两侧加入冒号 `:`,靠左、靠右或居中对齐列中的文本。
```markdown
| Left-aligned | Center-aligned | Right-aligned |
| :--- | :---: | ---: |
| git status | git status | git status |
| git diff | git diff | git diff |
```
![呈现的文本靠左、居中和靠右对齐的表格](/assets/images/help/writing/table-aligned-text-rendered.png)
要包含竖线 `|` 作为单元格中的内容,请在竖线前使用 `\`
```markdown
| Name | Character |
| --- | --- |
| Backtick | ` |
| Pipe | \| |
```
![呈现的带逸出竖线字符的表格](/assets/images/help/writing/table-escaped-character-rendered.png)
## 延伸阅读
- [{% data variables.product.prodname_dotcom %} Flavored Markdown 规格](https://github.github.com/gfm/)
- "[基本撰写和格式语法](/articles/basic-writing-and-formatting-syntax)"

View File

@@ -0,0 +1,34 @@
---
title: 在议题和拉取请求中使用关键字
intro: 使用关键字链接议题和拉取请求,或将议题或拉取请求标记为重复。
versions:
fpt: '*'
ghes: '*'
ghae: '*'
ghec: '*'
redirect_from:
- /github/writing-on-github/working-with-advanced-formatting/using-keywords-in-issues-and-pull-requests
topics:
- Issues
- Pull requests
---
## 将拉取请求链接到议题
要将拉取请求链接到议题以{% ifversion fpt or ghes or ghae or ghec %} 显示正在进行的修复,并且{% endif %} 当有人合并拉取请求时自动关闭议题,请键入以下关键字之一,然后引用议题。 例如 `Closes #10``Fixes octo-org/octo-repo#100`
* close
* closes
* closed
* fix
* fixes
* fixed
* 解决
* resolves
* resolved
更多信息请参阅“[将拉取请求链接到议题](/github/managing-your-work-on-github/linking-a-pull-request-to-an-issue)”。
## 将议题或拉取请求标记为重复
要将议题或拉取请求标记为重复,请在新评论正文中输入 "Duplicate of",后接它复制的议题或拉取请求编号。 更多信息请参阅“[将议题或拉取请求标记为重复](/issues/tracking-your-work-with-issues/marking-issues-or-pull-requests-as-a-duplicate)”。

View File

@@ -0,0 +1,30 @@
---
title: 关于已保存回复
intro: 您可以使用已保存回复来响应议题或拉取请求。
redirect_from:
- /articles/about-saved-replies
- /github/writing-on-github/about-saved-replies
- /github/writing-on-github/working-with-saved-replies/about-saved-replies
versions:
fpt: '*'
ghes: '*'
ghae: '*'
ghec: '*'
---
![已保存回复](/assets/images/help/settings/saved-replies.png)
已保存回复用于创建可重复使用的议题和拉取请求响应。 创建回复作为常用响应可节省时间。
已保存回复在添加后,可用于议题和拉取请求。 已保存回复与您的用户帐户关联。 在它们创建后,便可用于不同的仓库和组织。
最多可以创建 100 个已保存回复。 如果已达到最大限制,可以删除不再使用的已保存回复,或者编辑现有的已保存回复。
您也可以使用 {% data variables.product.product_name %} 提供“重复议题”已保存回复来将议题标记为重复,并用类似的议题跟踪它。
## 延伸阅读
- "[创建已保存回复](/articles/creating-a-saved-reply)"
- "[使用已保存回复](/articles/using-saved-replies)"
- "[编辑已保存回复](/articles/editing-a-saved-reply)"
- "[删除已保存回复](/articles/deleting-a-saved-reply)"

View File

@@ -0,0 +1,26 @@
---
title: 创建已保存回复
intro: 如果您经常反复添加相同的评论,您可以创建已保存回复。
redirect_from:
- /articles/creating-a-saved-reply
- /github/writing-on-github/creating-a-saved-reply
- /github/writing-on-github/working-with-saved-replies/creating-a-saved-reply
versions:
fpt: '*'
ghes: '*'
ghae: '*'
ghec: '*'
---
{% data reusables.user_settings.access_settings %}
{% data reusables.user_settings.saved_replies %}
3. 在“Add a saved reply添加已保存回复”下添加已保存回复的标题。 ![已保存回复标题](/assets/images/help/settings/saved-replies-title.png)
4. 在“Write撰写 )”字段中,添加要用于已保存回复的内容。 有关在 {% data variables.product.product_name %} 上撰写的更多信息,请参阅“[基本撰写和格式语法](/articles/basic-writing-and-formatting-syntax)”。 ![撰写已保存回复](/assets/images/help/settings/saved-replies-settings-adding.png)
5. 要查看回复,请单击 **Preview预览**。 ![添加已保存回复](/assets/images/help/settings/saved-replies-preview.png)
6. 单击 **Add saved reply添加已保存回复**。 !["添加已保存回复"按钮](/assets/images/help/settings/saved-replies-add-button.png)
## 延伸阅读
- "[使用已保存回复](/articles/using-saved-replies)"
- "[编辑已保存回复](/articles/editing-a-saved-reply)"
- "[删除已保存回复](/articles/deleting-a-saved-reply)"

View File

@@ -0,0 +1,18 @@
---
title: 删除已保存回复
intro: 如果发现不再使用某个已保存回复,可将其删除。
redirect_from:
- /articles/deleting-a-saved-reply
- /github/writing-on-github/deleting-a-saved-reply
- /github/writing-on-github/working-with-saved-replies/deleting-a-saved-reply
versions:
fpt: '*'
ghes: '*'
ghae: '*'
ghec: '*'
---
{% data reusables.user_settings.access_settings %}
{% data reusables.user_settings.saved_replies %}
3. 在“已保存回复”下,靠近要删除的已保存回复的位置,单击 {% octicon "x" aria-label="The X" %}。
![删除已保存回复](/assets/images/help/settings/saved-replies-delete-existing.png)

View File

@@ -0,0 +1,27 @@
---
title: 编辑已保存回复
intro: 您可以编辑已保存回复的标题和正文。
redirect_from:
- /articles/changing-a-saved-reply
- /articles/editing-a-saved-reply
- /github/writing-on-github/editing-a-saved-reply
- /github/writing-on-github/working-with-saved-replies/editing-a-saved-reply
versions:
fpt: '*'
ghes: '*'
ghae: '*'
ghec: '*'
---
{% data reusables.user_settings.access_settings %}
{% data reusables.user_settings.saved_replies %}
3. 使用位于要编辑已保存回复旁边的“Saved replies”已保存回复单击 {% octicon "pencil" aria-label="The pencil" %}。
![编辑已保存回复](/assets/images/help/settings/saved-replies-edit-existing.png)
4. 在“ Edit saved reply”已保存回复您可以编辑已保存回复的标题和内容。 ![编辑标题和内容](/assets/images/help/settings/saved-replies-edit-existing-content.png)
5. 单击 **Update saved reply更新已保存回复**。 ![更新已保存回复](/assets/images/help/settings/saved-replies-save-edit.png)
## 延伸阅读
- "[创建已保存回复](/articles/creating-a-saved-reply)"
- "[删除已保存回复](/articles/deleting-a-saved-reply)"
- "[使用已保存回复](/articles/using-saved-replies)"

View File

@@ -0,0 +1,20 @@
---
title: 使用已保存回复
intro: 为节省时间并确保提供一致的消息,您可将已保存回复添加到议题和拉取请求评论。
redirect_from:
- /articles/working-with-saved-replies
- /github/writing-on-github/working-with-saved-replies
versions:
fpt: '*'
ghes: '*'
ghae: '*'
ghec: '*'
children:
- /about-saved-replies
- /creating-a-saved-reply
- /editing-a-saved-reply
- /deleting-a-saved-reply
- /using-saved-replies
shortTitle: 处理已保存回复
---

Some files were not shown because too many files have changed in this diff Show More