1
0
mirror of synced 2026-01-06 06:02:35 -05:00

New translation batch for cn (#32868)

This commit is contained in:
docubot
2022-11-22 09:16:48 -08:00
committed by GitHub
parent eeff51e519
commit 0eb6441b3e
222 changed files with 6784 additions and 3406 deletions

View File

@@ -53,6 +53,7 @@ translations/zh-CN/content/account-and-profile/setting-up-and-managing-your-pers
translations/zh-CN/content/actions/automating-builds-and-tests/building-and-testing-nodejs-or-python.md,file deleted because it no longer exists in main
translations/zh-CN/content/admin/code-security/managing-github-advanced-security-for-your-enterprise/deploying-github-advanced-security-in-your-enterprise.md,file deleted because it no longer exists in main
translations/zh-CN/content/admin/code-security/managing-github-advanced-security-for-your-enterprise/overview-of-github-advanced-security-deployment.md,file deleted because it no longer exists in main
translations/zh-CN/content/admin/configuration/configuring-your-enterprise/restricting-network-traffic-to-your-enterprise.md,file deleted because it no longer exists in main
translations/zh-CN/content/admin/configuration/configuring-your-enterprise/troubleshooting-ssl-errors.md,file deleted because it no longer exists in main
translations/zh-CN/content/admin/github-actions/enabling-github-actions-for-github-enterprise-server/enabling-github-actions-with-minio-gateway-for-nas-storage.md,file deleted because it no longer exists in main
translations/zh-CN/content/admin/identity-and-access-management/authenticating-users-for-your-github-enterprise-server-instance/index.md,file deleted because it no longer exists in main
@@ -229,6 +230,7 @@ translations/zh-CN/content/rest/reference/users.md,file deleted because it no lo
translations/zh-CN/content/rest/reference/webhooks.md,file deleted because it no longer exists in main
translations/zh-CN/content/site-policy/privacy-policies/github-data-protection-agreement.md,file deleted because it no longer exists in main
translations/zh-CN/content/sponsors/receiving-sponsorships-through-github-sponsors/setting-up-github-sponsors-for-your-user-account.md,file deleted because it no longer exists in main
translations/zh-CN/data/features/ip-allow-list-address-check.yml,file deleted because it no longer exists in main
translations/zh-CN/data/features/security-overview-views.yml,file deleted because it no longer exists in main
translations/zh-CN/data/glossaries/internal.yml,file deleted because it no longer exists in main
translations/zh-CN/data/graphql/ghes-3.1/graphql_previews.enterprise.yml,file deleted because it no longer exists in main
@@ -388,6 +390,7 @@ translations/zh-CN/data/reusables/dotcom_billing/monthly-spending-limit-codespac
translations/zh-CN/data/reusables/dotcom_billing/pricing_calculator/pricing_cal_codespaces.md,file deleted because it no longer exists in main
translations/zh-CN/data/reusables/education/upgrade-organization.md,file deleted because it no longer exists in main
translations/zh-CN/data/reusables/education/upgrade-page.md,file deleted because it no longer exists in main
translations/zh-CN/data/reusables/enterprise-accounts/oidc-beta-notice.md,file deleted because it no longer exists in main
translations/zh-CN/data/reusables/enterprise-accounts/repository-visibility-policy.md,file deleted because it no longer exists in main
translations/zh-CN/data/reusables/enterprise-licensing/you-can-sync-for-a-combined-view.md,file deleted because it no longer exists in main
translations/zh-CN/data/reusables/enterprise_management_console/username_normalization_sample.md,file deleted because it no longer exists in main
@@ -488,6 +491,7 @@ translations/zh-CN/content/actions/managing-issues-and-pull-requests/moving-assi
translations/zh-CN/content/actions/managing-workflow-runs/disabling-and-enabling-a-workflow.md,rendering error
translations/zh-CN/content/actions/managing-workflow-runs/manually-running-a-workflow.md,rendering error
translations/zh-CN/content/actions/managing-workflow-runs/re-running-workflows-and-jobs.md,rendering error
translations/zh-CN/content/actions/migrating-to-github-actions/automating-migration-with-github-actions-importer.md,rendering error
translations/zh-CN/content/actions/monitoring-and-troubleshooting-workflows/viewing-job-execution-time.md,rendering error
translations/zh-CN/content/actions/publishing-packages/publishing-docker-images.md,rendering error
translations/zh-CN/content/actions/publishing-packages/publishing-nodejs-packages.md,broken liquid tags
@@ -499,7 +503,6 @@ translations/zh-CN/content/actions/using-github-hosted-runners/about-github-host
translations/zh-CN/content/actions/using-github-hosted-runners/controlling-access-to-larger-runners.md,rendering error
translations/zh-CN/content/actions/using-github-hosted-runners/using-larger-runners.md,rendering error
translations/zh-CN/content/actions/using-workflows/about-workflows.md,rendering error
translations/zh-CN/content/actions/using-workflows/caching-dependencies-to-speed-up-workflows.md,broken liquid tags
translations/zh-CN/content/actions/using-workflows/creating-starter-workflows-for-your-organization.md,rendering error
translations/zh-CN/content/actions/using-workflows/events-that-trigger-workflows.md,rendering error
translations/zh-CN/content/actions/using-workflows/reusing-workflows.md,rendering error
@@ -536,9 +539,7 @@ translations/zh-CN/content/admin/configuration/configuring-your-enterprise/confi
translations/zh-CN/content/admin/configuration/configuring-your-enterprise/configuring-web-commit-signing.md,rendering error
translations/zh-CN/content/admin/configuration/configuring-your-enterprise/enabling-and-scheduling-maintenance-mode.md,rendering error
translations/zh-CN/content/admin/configuration/configuring-your-enterprise/enabling-private-mode.md,rendering error
translations/zh-CN/content/admin/configuration/configuring-your-enterprise/initializing-github-ae.md,rendering error
translations/zh-CN/content/admin/configuration/configuring-your-enterprise/managing-github-mobile-for-your-enterprise.md,rendering error
translations/zh-CN/content/admin/configuration/configuring-your-enterprise/restricting-network-traffic-to-your-enterprise.md,broken liquid tags
translations/zh-CN/content/admin/configuration/configuring-your-enterprise/site-admin-dashboard.md,rendering error
translations/zh-CN/content/admin/configuration/configuring-your-enterprise/troubleshooting-tls-errors.md,rendering error
translations/zh-CN/content/admin/enterprise-management/caching-repositories/about-repository-caching.md,rendering error
@@ -546,7 +547,6 @@ translations/zh-CN/content/admin/enterprise-management/caching-repositories/conf
translations/zh-CN/content/admin/enterprise-management/caching-repositories/index.md,rendering error
translations/zh-CN/content/admin/enterprise-management/configuring-clustering/cluster-network-configuration.md,broken liquid tags
translations/zh-CN/content/admin/enterprise-management/configuring-clustering/configuring-high-availability-replication-for-a-cluster.md,broken liquid tags
translations/zh-CN/content/admin/enterprise-management/configuring-clustering/initializing-the-cluster.md,broken liquid tags
translations/zh-CN/content/admin/enterprise-management/monitoring-your-appliance/accessing-the-monitor-dashboard.md,rendering error
translations/zh-CN/content/admin/enterprise-management/monitoring-your-appliance/configuring-collectd.md,rendering error
translations/zh-CN/content/admin/enterprise-management/monitoring-your-appliance/generating-a-health-check-for-your-enterprise.md,rendering error
@@ -559,12 +559,12 @@ translations/zh-CN/content/admin/enterprise-management/updating-the-virtual-mach
translations/zh-CN/content/admin/enterprise-management/updating-the-virtual-machine-and-physical-resources/upgrading-github-enterprise-server.md,rendering error
translations/zh-CN/content/admin/github-actions/advanced-configuration-and-troubleshooting/troubleshooting-github-actions-for-your-enterprise.md,rendering error
translations/zh-CN/content/admin/github-actions/advanced-configuration-and-troubleshooting/using-a-staging-environment.md,rendering error
translations/zh-CN/content/admin/github-actions/enabling-github-actions-for-github-enterprise-server/enabling-github-actions-with-minio-storage.md,rendering error
translations/zh-CN/content/admin/github-actions/enabling-github-actions-for-github-enterprise-server/managing-self-hosted-runners-for-dependabot-updates.md,rendering error
translations/zh-CN/content/admin/github-actions/getting-started-with-github-actions-for-your-enterprise/about-github-actions-for-enterprises.md,rendering error
translations/zh-CN/content/admin/github-actions/getting-started-with-github-actions-for-your-enterprise/getting-started-with-github-actions-for-github-enterprise-server.md,rendering error
translations/zh-CN/content/admin/github-actions/getting-started-with-github-actions-for-your-enterprise/getting-started-with-self-hosted-runners-for-your-enterprise.md,rendering error
translations/zh-CN/content/admin/github-actions/getting-started-with-github-actions-for-your-enterprise/introducing-github-actions-to-your-enterprise.md,rendering error
translations/zh-CN/content/admin/github-actions/getting-started-with-github-actions-for-your-enterprise/migrating-your-enterprise-to-github-actions.md,broken liquid tags
translations/zh-CN/content/admin/github-actions/managing-access-to-actions-from-githubcom/about-using-actions-in-your-enterprise.md,rendering error
translations/zh-CN/content/admin/identity-and-access-management/index.md,broken liquid tags
translations/zh-CN/content/admin/identity-and-access-management/managing-iam-for-your-enterprise/changing-authentication-methods.md,rendering error
@@ -576,6 +576,7 @@ translations/zh-CN/content/admin/identity-and-access-management/using-built-in-a
translations/zh-CN/content/admin/identity-and-access-management/using-built-in-authentication/inviting-people-to-use-your-instance.md,rendering error
translations/zh-CN/content/admin/identity-and-access-management/using-cas-for-enterprise-iam/index.md,rendering error
translations/zh-CN/content/admin/identity-and-access-management/using-cas-for-enterprise-iam/using-cas.md,rendering error
translations/zh-CN/content/admin/identity-and-access-management/using-enterprise-managed-users-for-iam/about-enterprise-managed-users.md,broken liquid tags
translations/zh-CN/content/admin/identity-and-access-management/using-enterprise-managed-users-for-iam/about-support-for-your-idps-conditional-access-policy.md,rendering error
translations/zh-CN/content/admin/identity-and-access-management/using-enterprise-managed-users-for-iam/configuring-oidc-for-enterprise-managed-users.md,rendering error
translations/zh-CN/content/admin/identity-and-access-management/using-enterprise-managed-users-for-iam/configuring-saml-single-sign-on-for-enterprise-managed-users.md,rendering error
@@ -583,7 +584,6 @@ translations/zh-CN/content/admin/identity-and-access-management/using-enterprise
translations/zh-CN/content/admin/identity-and-access-management/using-enterprise-managed-users-for-iam/migrating-from-saml-to-oidc.md,rendering error
translations/zh-CN/content/admin/identity-and-access-management/using-ldap-for-enterprise-iam/index.md,rendering error
translations/zh-CN/content/admin/identity-and-access-management/using-saml-for-enterprise-iam/about-saml-for-enterprise-iam.md,rendering error
translations/zh-CN/content/admin/identity-and-access-management/using-saml-for-enterprise-iam/configuring-authentication-and-provisioning-for-your-enterprise-using-azure-ad.md,broken liquid tags
translations/zh-CN/content/admin/identity-and-access-management/using-saml-for-enterprise-iam/configuring-saml-single-sign-on-for-your-enterprise.md,broken liquid tags
translations/zh-CN/content/admin/identity-and-access-management/using-saml-for-enterprise-iam/enabling-encrypted-assertions.md,rendering error
translations/zh-CN/content/admin/identity-and-access-management/using-saml-for-enterprise-iam/saml-configuration-reference.md,broken liquid tags
@@ -613,7 +613,6 @@ translations/zh-CN/content/admin/packages/enabling-github-packages-with-azure-bl
translations/zh-CN/content/admin/packages/enabling-github-packages-with-minio.md,rendering error
translations/zh-CN/content/admin/packages/getting-started-with-github-packages-for-your-enterprise.md,rendering error
translations/zh-CN/content/admin/packages/migrating-your-enterprise-to-the-container-registry-from-the-docker-registry.md,rendering error
translations/zh-CN/content/admin/packages/quickstart-for-configuring-your-minio-storage-bucket-for-github-packages.md,rendering error
translations/zh-CN/content/admin/policies/enforcing-policies-for-your-enterprise/about-enterprise-policies.md,broken liquid tags
translations/zh-CN/content/admin/policies/enforcing-policies-for-your-enterprise/enforcing-policies-for-github-actions-in-your-enterprise.md,rendering error
translations/zh-CN/content/admin/policies/enforcing-policies-for-your-enterprise/enforcing-policies-for-security-settings-in-your-enterprise.md,broken liquid tags
@@ -635,7 +634,6 @@ translations/zh-CN/content/admin/user-management/migrating-data-to-and-from-your
translations/zh-CN/content/admin/user-management/migrating-data-to-and-from-your-enterprise/migrating-data-to-your-enterprise.md,rendering error
translations/zh-CN/content/authentication/authenticating-with-saml-single-sign-on/authorizing-a-personal-access-token-for-use-with-saml-single-sign-on.md,rendering error
translations/zh-CN/content/authentication/authenticating-with-saml-single-sign-on/authorizing-an-ssh-key-for-use-with-saml-single-sign-on.md,rendering error
translations/zh-CN/content/authentication/authenticating-with-saml-single-sign-on/viewing-and-managing-your-active-saml-sessions.md,rendering error
translations/zh-CN/content/authentication/connecting-to-github-with-ssh/adding-a-new-ssh-key-to-your-github-account.md,rendering error
translations/zh-CN/content/authentication/connecting-to-github-with-ssh/checking-for-existing-ssh-keys.md,rendering error
translations/zh-CN/content/authentication/connecting-to-github-with-ssh/generating-a-new-ssh-key-and-adding-it-to-the-ssh-agent.md,rendering error
@@ -644,7 +642,6 @@ translations/zh-CN/content/authentication/keeping-your-account-and-data-secure/a
translations/zh-CN/content/authentication/keeping-your-account-and-data-secure/authorizing-oauth-apps.md,rendering error
translations/zh-CN/content/authentication/keeping-your-account-and-data-secure/creating-a-personal-access-token.md,rendering error
translations/zh-CN/content/authentication/keeping-your-account-and-data-secure/creating-a-strong-password.md,rendering error
translations/zh-CN/content/authentication/keeping-your-account-and-data-secure/index.md,rendering error
translations/zh-CN/content/authentication/keeping-your-account-and-data-secure/preventing-unauthorized-access.md,rendering error
translations/zh-CN/content/authentication/keeping-your-account-and-data-secure/removing-sensitive-data-from-a-repository.md,rendering error
translations/zh-CN/content/authentication/keeping-your-account-and-data-secure/reviewing-your-deploy-keys.md,rendering error
@@ -657,6 +654,7 @@ translations/zh-CN/content/authentication/managing-commit-signature-verification
translations/zh-CN/content/authentication/managing-commit-signature-verification/associating-an-email-with-your-gpg-key.md,rendering error
translations/zh-CN/content/authentication/managing-commit-signature-verification/displaying-verification-statuses-for-all-of-your-commits.md,rendering error
translations/zh-CN/content/authentication/managing-commit-signature-verification/index.md,broken liquid tags
translations/zh-CN/content/authentication/managing-commit-signature-verification/telling-git-about-your-signing-key.md,broken liquid tags
translations/zh-CN/content/authentication/securing-your-account-with-two-factor-authentication-2fa/about-two-factor-authentication.md,rendering error
translations/zh-CN/content/authentication/securing-your-account-with-two-factor-authentication-2fa/accessing-github-using-two-factor-authentication.md,broken liquid tags
translations/zh-CN/content/authentication/securing-your-account-with-two-factor-authentication-2fa/configuring-two-factor-authentication.md,rendering error
@@ -671,8 +669,6 @@ translations/zh-CN/content/billing/managing-billing-for-github-actions/about-bil
translations/zh-CN/content/billing/managing-billing-for-github-advanced-security/about-billing-for-github-advanced-security.md,broken liquid tags
translations/zh-CN/content/billing/managing-billing-for-github-advanced-security/viewing-your-github-advanced-security-usage.md,rendering error
translations/zh-CN/content/billing/managing-billing-for-github-codespaces/about-billing-for-github-codespaces.md,rendering error
translations/zh-CN/content/billing/managing-billing-for-github-codespaces/index.md,broken liquid tags
translations/zh-CN/content/billing/managing-billing-for-github-codespaces/viewing-your-github-codespaces-usage.md,broken liquid tags
translations/zh-CN/content/billing/managing-billing-for-github-copilot/about-billing-for-github-copilot.md,broken liquid tags
translations/zh-CN/content/billing/managing-billing-for-github-copilot/managing-your-github-copilot-subscription.md,broken liquid tags
translations/zh-CN/content/billing/managing-billing-for-github-packages/about-billing-for-github-packages.md,rendering error
@@ -728,6 +724,7 @@ translations/zh-CN/content/code-security/secret-scanning/managing-alerts-from-se
translations/zh-CN/content/code-security/secret-scanning/protecting-pushes-with-secret-scanning.md,rendering error
translations/zh-CN/content/code-security/secret-scanning/pushing-a-branch-blocked-by-push-protection.md,rendering error
translations/zh-CN/content/code-security/security-advisories/global-security-advisories/about-the-github-advisory-database.md,rendering error
translations/zh-CN/content/code-security/security-advisories/guidance-on-reporting-and-writing/managing-privately-reported-security-vulnerabilities.md,rendering error
translations/zh-CN/content/code-security/security-advisories/repository-security-advisories/configuring-private-vulnerability-reporting-for-a-repository.md,rendering error
translations/zh-CN/content/code-security/security-overview/about-the-security-overview.md,rendering error
translations/zh-CN/content/code-security/security-overview/filtering-alerts-in-the-security-overview.md,rendering error
@@ -736,62 +733,17 @@ translations/zh-CN/content/code-security/supply-chain-security/end-to-end-supply
translations/zh-CN/content/code-security/supply-chain-security/end-to-end-supply-chain/securing-code.md,rendering error
translations/zh-CN/content/code-security/supply-chain-security/understanding-your-software-supply-chain/about-dependency-review.md,rendering error
translations/zh-CN/content/code-security/supply-chain-security/understanding-your-software-supply-chain/about-the-dependency-graph.md,rendering error
translations/zh-CN/content/code-security/supply-chain-security/understanding-your-software-supply-chain/configuring-dependency-review.md,broken liquid tags
translations/zh-CN/content/code-security/supply-chain-security/understanding-your-software-supply-chain/configuring-the-dependency-graph.md,broken liquid tags
translations/zh-CN/content/codespaces/codespaces-reference/disaster-recovery-for-github-codespaces.md,broken liquid tags
translations/zh-CN/content/codespaces/codespaces-reference/security-in-github-codespaces.md,broken liquid tags
translations/zh-CN/content/codespaces/codespaces-reference/using-github-copilot-in-github-codespaces.md,broken liquid tags
translations/zh-CN/content/codespaces/codespaces-reference/using-the-vs-code-command-palette-in-codespaces.md,broken liquid tags
translations/zh-CN/content/codespaces/customizing-your-codespace/changing-the-machine-type-for-your-codespace.md,broken liquid tags
translations/zh-CN/content/codespaces/customizing-your-codespace/configuring-automatic-deletion-of-your-codespaces.md,broken liquid tags
translations/zh-CN/content/codespaces/customizing-your-codespace/personalizing-github-codespaces-for-your-account.md,broken liquid tags
translations/zh-CN/content/codespaces/customizing-your-codespace/renaming-a-codespace.md,broken liquid tags
translations/zh-CN/content/codespaces/customizing-your-codespace/setting-your-default-editor-for-github-codespaces.md,broken liquid tags
translations/zh-CN/content/codespaces/customizing-your-codespace/setting-your-timeout-period-for-github-codespaces.md,broken liquid tags
translations/zh-CN/content/codespaces/developing-in-codespaces/connecting-to-a-private-network.md,broken liquid tags
translations/zh-CN/content/codespaces/developing-in-codespaces/deleting-a-codespace.md,broken liquid tags
translations/zh-CN/content/codespaces/developing-in-codespaces/developing-in-a-codespace.md,broken liquid tags
translations/zh-CN/content/codespaces/developing-in-codespaces/forwarding-ports-in-your-codespace.md,broken liquid tags
translations/zh-CN/content/codespaces/developing-in-codespaces/opening-an-existing-codespace.md,broken liquid tags
translations/zh-CN/content/codespaces/developing-in-codespaces/stopping-and-starting-a-codespace.md,broken liquid tags
translations/zh-CN/content/codespaces/developing-in-codespaces/using-github-codespaces-for-pull-requests.md,broken liquid tags
translations/zh-CN/content/codespaces/developing-in-codespaces/using-github-codespaces-in-visual-studio-code.md,rendering error
translations/zh-CN/content/codespaces/developing-in-codespaces/using-source-control-in-your-codespace.md,broken liquid tags
translations/zh-CN/content/codespaces/getting-started/deep-dive.md,broken liquid tags
translations/zh-CN/content/codespaces/getting-started/quickstart.md,broken liquid tags
translations/zh-CN/content/codespaces/managing-codespaces-for-your-organization/enabling-github-codespaces-for-your-organization.md,broken liquid tags
translations/zh-CN/content/codespaces/managing-codespaces-for-your-organization/index.md,broken liquid tags
translations/zh-CN/content/codespaces/managing-codespaces-for-your-organization/listing-the-codespaces-in-your-organization.md,broken liquid tags
translations/zh-CN/content/codespaces/managing-codespaces-for-your-organization/managing-repository-access-for-your-organizations-codespaces.md,broken liquid tags
translations/zh-CN/content/codespaces/managing-codespaces-for-your-organization/restricting-access-to-machine-types.md,broken liquid tags
translations/zh-CN/content/codespaces/managing-codespaces-for-your-organization/restricting-the-idle-timeout-period.md,broken liquid tags
translations/zh-CN/content/codespaces/managing-codespaces-for-your-organization/restricting-the-retention-period-for-codespaces.md,broken liquid tags
translations/zh-CN/content/codespaces/managing-codespaces-for-your-organization/restricting-the-visibility-of-forwarded-ports.md,broken liquid tags
translations/zh-CN/content/codespaces/managing-codespaces-for-your-organization/reviewing-your-organizations-audit-logs-for-github-codespaces.md,broken liquid tags
translations/zh-CN/content/codespaces/managing-your-codespaces/managing-encrypted-secrets-for-your-codespaces.md,broken liquid tags
translations/zh-CN/content/codespaces/managing-your-codespaces/managing-gpg-verification-for-github-codespaces.md,broken liquid tags
translations/zh-CN/content/codespaces/managing-your-codespaces/managing-repository-access-for-your-codespaces.md,broken liquid tags
translations/zh-CN/content/codespaces/managing-your-codespaces/reviewing-your-security-logs-for-github-codespaces.md,broken liquid tags
translations/zh-CN/content/codespaces/prebuilding-your-codespaces/about-github-codespaces-prebuilds.md,broken liquid tags
translations/zh-CN/content/codespaces/developing-in-codespaces/creating-a-codespace-for-a-repository.md,rendering error
translations/zh-CN/content/codespaces/developing-in-codespaces/creating-a-codespace-from-a-template.md,rendering error
translations/zh-CN/content/codespaces/developing-in-codespaces/the-codespace-lifecycle.md,broken liquid tags
translations/zh-CN/content/codespaces/prebuilding-your-codespaces/configuring-prebuilds.md,rendering error
translations/zh-CN/content/codespaces/prebuilding-your-codespaces/managing-prebuilds.md,broken liquid tags
translations/zh-CN/content/codespaces/prebuilding-your-codespaces/testing-dev-container-changes.md,broken liquid tags
translations/zh-CN/content/codespaces/setting-up-your-project-for-codespaces/adding-a-codespaces-badge.md,rendering error
translations/zh-CN/content/codespaces/setting-up-your-project-for-codespaces/introduction-to-dev-containers.md,broken liquid tags
translations/zh-CN/content/codespaces/setting-up-your-project-for-codespaces/setting-a-minimum-specification-for-codespace-machines.md,broken liquid tags
translations/zh-CN/content/codespaces/setting-up-your-project-for-codespaces/setting-up-your-dotnet-project-for-codespaces.md,broken liquid tags
translations/zh-CN/content/codespaces/setting-up-your-project-for-codespaces/setting-up-your-java-project-for-codespaces.md,broken liquid tags
translations/zh-CN/content/codespaces/setting-up-your-project-for-codespaces/setting-up-your-nodejs-project-for-codespaces.md,broken liquid tags
translations/zh-CN/content/codespaces/setting-up-your-project-for-codespaces/setting-up-your-python-project-for-codespaces.md,broken liquid tags
translations/zh-CN/content/codespaces/setting-up-your-project-for-codespaces/adding-features-to-a-devcontainer-file.md,broken liquid tags
translations/zh-CN/content/codespaces/the-githubdev-web-based-editor.md,rendering error
translations/zh-CN/content/codespaces/troubleshooting/exporting-changes-to-a-branch.md,broken liquid tags
translations/zh-CN/content/codespaces/troubleshooting/github-codespaces-logs.md,broken liquid tags
translations/zh-CN/content/codespaces/troubleshooting/index.md,broken liquid tags
translations/zh-CN/content/codespaces/troubleshooting/troubleshooting-creation-and-deletion-of-codespaces.md,broken liquid tags
translations/zh-CN/content/codespaces/troubleshooting/troubleshooting-port-forwarding-for-github-codespaces.md,broken liquid tags
translations/zh-CN/content/codespaces/troubleshooting/troubleshooting-prebuilds.md,broken liquid tags
translations/zh-CN/content/codespaces/troubleshooting/troubleshooting-your-connection-to-github-codespaces.md,broken liquid tags
translations/zh-CN/content/codespaces/troubleshooting/working-with-support-for-github-codespaces.md,broken liquid tags
translations/zh-CN/content/codespaces/troubleshooting/troubleshooting-prebuilds.md,rendering error
translations/zh-CN/content/communities/documenting-your-project-with-wikis/about-wikis.md,rendering error
translations/zh-CN/content/communities/documenting-your-project-with-wikis/changing-access-permissions-for-wikis.md,rendering error
translations/zh-CN/content/communities/documenting-your-project-with-wikis/editing-wiki-content.md,rendering error
@@ -830,14 +782,12 @@ translations/zh-CN/content/discussions/guides/finding-your-discussions.md,render
translations/zh-CN/content/discussions/managing-discussions-for-your-community/managing-categories-for-discussions.md,rendering error
translations/zh-CN/content/discussions/managing-discussions-for-your-community/managing-discussions.md,rendering error
translations/zh-CN/content/discussions/managing-discussions-for-your-community/moderating-discussions.md,rendering error
translations/zh-CN/content/education/explore-the-benefits-of-teaching-and-learning-with-github-education/github-global-campus-for-students/about-github-global-campus-for-students.md,broken liquid tags
translations/zh-CN/content/education/explore-the-benefits-of-teaching-and-learning-with-github-education/github-global-campus-for-teachers/about-github-global-campus-for-teachers.md,broken liquid tags
translations/zh-CN/content/education/manage-coursework-with-github-classroom/get-started-with-github-classroom/glossary.md,broken liquid tags
translations/zh-CN/content/education/manage-coursework-with-github-classroom/integrate-github-classroom-with-an-ide/about-using-makecode-arcade-with-github-classroom.md,rendering error
translations/zh-CN/content/education/manage-coursework-with-github-classroom/integrate-github-classroom-with-an-ide/integrate-github-classroom-with-an-ide.md,broken liquid tags
translations/zh-CN/content/education/manage-coursework-with-github-classroom/integrate-github-classroom-with-an-ide/using-github-codespaces-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,rendering error
translations/zh-CN/content/education/manage-coursework-with-github-classroom/teach-with-github-classroom/create-a-group-assignment.md,rendering error
translations/zh-CN/content/education/manage-coursework-with-github-classroom/teach-with-github-classroom/create-an-individual-assignment.md,broken liquid tags
translations/zh-CN/content/education/manage-coursework-with-github-classroom/teach-with-github-classroom/manage-classrooms.md,broken liquid tags
translations/zh-CN/content/education/manage-coursework-with-github-classroom/teach-with-github-classroom/use-the-git-and-github-starter-assignment.md,broken liquid tags
translations/zh-CN/content/get-started/customizing-your-github-workflow/exploring-integrations/github-extensions-and-integrations.md,rendering error
@@ -871,12 +821,12 @@ translations/zh-CN/content/get-started/signing-up-for-github/setting-up-a-trial-
translations/zh-CN/content/get-started/signing-up-for-github/verifying-your-email-address.md,rendering error
translations/zh-CN/content/get-started/using-git/about-git-rebase.md,rendering error
translations/zh-CN/content/get-started/using-git/splitting-a-subfolder-out-into-a-new-repository.md,rendering error
translations/zh-CN/content/get-started/using-github/github-command-palette.md,rendering error
translations/zh-CN/content/get-started/using-github/github-mobile.md,rendering error
translations/zh-CN/content/get-started/using-github/keyboard-shortcuts.md,rendering error
translations/zh-CN/content/get-started/writing-on-github/getting-started-with-writing-and-formatting-on-github/about-writing-and-formatting-on-github.md,broken liquid tags
translations/zh-CN/content/get-started/writing-on-github/getting-started-with-writing-and-formatting-on-github/basic-writing-and-formatting-syntax.md,rendering error
translations/zh-CN/content/get-started/writing-on-github/getting-started-with-writing-and-formatting-on-github/quickstart-for-writing-on-github.md,rendering error
translations/zh-CN/content/get-started/writing-on-github/working-with-advanced-formatting/about-task-lists.md,rendering error
translations/zh-CN/content/get-started/writing-on-github/working-with-advanced-formatting/autolinked-references-and-urls.md,broken liquid tags
translations/zh-CN/content/get-started/writing-on-github/working-with-advanced-formatting/writing-mathematical-expressions.md,rendering error
translations/zh-CN/content/github-cli/github-cli/quickstart.md,rendering error
@@ -894,12 +844,12 @@ translations/zh-CN/content/graphql/reference/unions.md,rendering error
translations/zh-CN/content/issues/organizing-your-work-with-project-boards/managing-project-boards/changing-project-board-visibility.md,rendering error
translations/zh-CN/content/issues/organizing-your-work-with-project-boards/managing-project-boards/copying-a-project-board.md,rendering error
translations/zh-CN/content/issues/organizing-your-work-with-project-boards/managing-project-boards/creating-a-project-board.md,rendering error
translations/zh-CN/content/issues/planning-and-tracking-with-projects/learning-about-projects/about-projects.md,broken liquid tags
translations/zh-CN/content/issues/tracking-your-work-with-issues/linking-a-pull-request-to-an-issue.md,rendering error
translations/zh-CN/content/organizations/collaborating-with-groups-in-organizations/about-your-organizations-news-feed.md,rendering error
translations/zh-CN/content/organizations/granting-access-to-your-organization-with-saml-single-sign-on/about-two-factor-authentication-and-saml-single-sign-on.md,rendering error
translations/zh-CN/content/organizations/granting-access-to-your-organization-with-saml-single-sign-on/viewing-and-managing-a-members-saml-access-to-your-organization.md,rendering error
translations/zh-CN/content/organizations/keeping-your-organization-secure/managing-security-settings-for-your-organization/accessing-compliance-reports-for-your-organization.md,rendering error
translations/zh-CN/content/organizations/keeping-your-organization-secure/managing-security-settings-for-your-organization/managing-allowed-ip-addresses-for-your-organization.md,broken liquid tags
translations/zh-CN/content/organizations/keeping-your-organization-secure/managing-security-settings-for-your-organization/managing-security-and-analysis-settings-for-your-organization.md,rendering error
translations/zh-CN/content/organizations/keeping-your-organization-secure/managing-security-settings-for-your-organization/reviewing-the-audit-log-for-your-organization.md,rendering error
translations/zh-CN/content/organizations/managing-git-access-to-your-organizations-repositories/about-ssh-certificate-authorities.md,broken liquid tags
@@ -948,7 +898,6 @@ translations/zh-CN/content/pull-requests/collaborating-with-pull-requests/propos
translations/zh-CN/content/pull-requests/collaborating-with-pull-requests/proposing-changes-to-your-work-with-pull-requests/keeping-your-pull-request-in-sync-with-the-base-branch.md,rendering error
translations/zh-CN/content/pull-requests/collaborating-with-pull-requests/reviewing-changes-in-pull-requests/reviewing-dependency-changes-in-a-pull-request.md,rendering error
translations/zh-CN/content/pull-requests/collaborating-with-pull-requests/reviewing-changes-in-pull-requests/reviewing-proposed-changes-in-a-pull-request.md,rendering error
translations/zh-CN/content/pull-requests/collaborating-with-pull-requests/working-with-forks/about-forks.md,broken liquid tags
translations/zh-CN/content/pull-requests/collaborating-with-pull-requests/working-with-forks/syncing-a-fork.md,rendering error
translations/zh-CN/content/pull-requests/committing-changes-to-your-project/creating-and-editing-commits/changing-a-commit-message.md,rendering error
translations/zh-CN/content/pull-requests/committing-changes-to-your-project/creating-and-editing-commits/creating-a-commit-on-behalf-of-an-organization.md,rendering error
@@ -1021,9 +970,7 @@ translations/zh-CN/content/rest/packages.md,broken liquid tags
translations/zh-CN/content/rest/projects/projects.md,broken liquid tags
translations/zh-CN/content/rest/scim.md,rendering error
translations/zh-CN/content/rest/teams/team-sync.md,rendering error
translations/zh-CN/content/search-github/getting-started-with-searching-on-github/about-searching-on-github.md,rendering error
translations/zh-CN/content/search-github/getting-started-with-searching-on-github/enabling-githubcom-repository-search-from-your-private-enterprise-environment.md,rendering error
translations/zh-CN/content/search-github/searching-on-github/searching-code.md,broken liquid tags
translations/zh-CN/content/search-github/searching-on-github/searching-for-repositories.md,rendering error
translations/zh-CN/content/sponsors/receiving-sponsorships-through-github-sponsors/managing-your-sponsorship-tiers.md,broken liquid tags
translations/zh-CN/content/sponsors/receiving-sponsorships-through-github-sponsors/setting-up-github-sponsors-for-your-organization.md,rendering error
@@ -1083,6 +1030,7 @@ translations/zh-CN/data/reusables/actions/settings-ui/settings-actions-pages-cus
translations/zh-CN/data/reusables/actions/settings-ui/settings-actions-runner-groups.md,rendering error
translations/zh-CN/data/reusables/actions/settings-ui/settings-actions-runners.md,rendering error
translations/zh-CN/data/reusables/actions/sidebar-secret.md,rendering error
translations/zh-CN/data/reusables/actions/supported-github-runners.md,broken liquid tags
translations/zh-CN/data/reusables/actions/upgrade-runners-before-upgrade-ghes.md,rendering error
translations/zh-CN/data/reusables/actions/workflow-basic-example-and-explanation.md,rendering error
translations/zh-CN/data/reusables/actions/workflow-dispatch-inputs.md,rendering error
@@ -1107,20 +1055,17 @@ translations/zh-CN/data/reusables/code-scanning/enterprise-enable-code-scanning.
translations/zh-CN/data/reusables/code-scanning/licensing-note.md,broken liquid tags
translations/zh-CN/data/reusables/code-scanning/run-additional-queries.md,broken liquid tags
translations/zh-CN/data/reusables/code-scanning/what-is-codeql-cli.md,rendering error
translations/zh-CN/data/reusables/codespaces/codespaces-disabling-org-billing.md,broken liquid tags
translations/zh-CN/data/reusables/codespaces/codespaces-spending-limit-requirement.md,broken liquid tags
translations/zh-CN/data/reusables/codespaces/creating-a-codespace-in-vscode.md,rendering error
translations/zh-CN/data/reusables/codespaces/customize-vcpus-and-ram.md,broken liquid tags
translations/zh-CN/data/reusables/codespaces/next-steps-adding-devcontainer.md,broken liquid tags
translations/zh-CN/data/reusables/codespaces/prebuilds-crossreference.md,broken liquid tags
translations/zh-CN/data/reusables/codespaces/rebuild-command.md,broken liquid tags
translations/zh-CN/data/reusables/codespaces/secrets-on-start.md,broken liquid tags
translations/zh-CN/data/reusables/codespaces/use-chrome.md,broken liquid tags
translations/zh-CN/data/reusables/command_line/provide-an-access-token.md,broken liquid tags
translations/zh-CN/data/reusables/copilot/install-copilot-in-neovim.md,broken liquid tags
translations/zh-CN/data/reusables/dependabot/beta-security-and-version-updates.md,rendering error
translations/zh-CN/data/reusables/dependabot/default-dependencies-allow-ignore.md,broken liquid tags
translations/zh-CN/data/reusables/dependabot/dependabot-alerts-dependency-scope.md,broken liquid tags
translations/zh-CN/data/reusables/dependabot/dependabot-alerts-filters.md,rendering error
translations/zh-CN/data/reusables/dependabot/enabling-disabling-dependency-graph-private-repo.md,rendering error
translations/zh-CN/data/reusables/dependabot/sidebar-secret.md,rendering error
translations/zh-CN/data/reusables/dependabot/supported-package-managers.md,rendering error
@@ -1133,6 +1078,7 @@ translations/zh-CN/data/reusables/dotcom_billing/view-all-subscriptions.md,rende
translations/zh-CN/data/reusables/enterprise-accounts/actions-packages-report-download-enterprise-accounts.md,broken liquid tags
translations/zh-CN/data/reusables/enterprise-accounts/billing-microsoft-ea-overview.md,broken liquid tags
translations/zh-CN/data/reusables/enterprise-accounts/dormant-user-activity.md,rendering error
translations/zh-CN/data/reusables/enterprise-accounts/emu-azure-admin-consent.md,broken liquid tags
translations/zh-CN/data/reusables/enterprise-accounts/emu-cap-validates.md,broken liquid tags
translations/zh-CN/data/reusables/enterprise-accounts/emu-forks.md,rendering error
translations/zh-CN/data/reusables/enterprise-accounts/emu-permission-follow.md,broken liquid tags
@@ -1175,7 +1121,10 @@ translations/zh-CN/data/reusables/getting-started/enforcing-repo-management-poli
translations/zh-CN/data/reusables/getting-started/enterprise-advanced-security.md,broken liquid tags
translations/zh-CN/data/reusables/getting-started/managing-enterprise-members.md,rendering error
translations/zh-CN/data/reusables/git/git-push.md,rendering error
translations/zh-CN/data/reusables/identity-and-permissions/ip-allow-lists-enable.md,broken liquid tags
translations/zh-CN/data/reusables/identity-and-permissions/about-adding-ip-allow-list-entries.md,broken liquid tags
translations/zh-CN/data/reusables/identity-and-permissions/about-editing-ip-allow-list-entries.md,broken liquid tags
translations/zh-CN/data/reusables/identity-and-permissions/about-enabling-allowed-ip-addresses.md,broken liquid tags
translations/zh-CN/data/reusables/identity-and-permissions/ip-allow-lists-githubapps-enterprise.md,broken liquid tags
translations/zh-CN/data/reusables/identity-and-permissions/vigilant-mode-beta-note.md,rendering error
translations/zh-CN/data/reusables/large_files/storage_assets_location.md,broken liquid tags
translations/zh-CN/data/reusables/large_files/use_lfs_tip.md,rendering error
@@ -1202,7 +1151,6 @@ translations/zh-CN/data/reusables/pages/emu-org-only.md,broken liquid tags
translations/zh-CN/data/reusables/pages/sidebar-pages.md,rendering error
translations/zh-CN/data/reusables/projects/enable-basic-workflow.md,broken liquid tags
translations/zh-CN/data/reusables/projects/graphql-ghes.md,rendering error
translations/zh-CN/data/reusables/projects/projects-filters.md,broken liquid tags
translations/zh-CN/data/reusables/pull_requests/configure_pull_request_merges_intro.md,rendering error
translations/zh-CN/data/reusables/pull_requests/default_merge_option.md,rendering error
translations/zh-CN/data/reusables/pull_requests/pull_request_merges_and_contributions.md,rendering error
1 file reason
53 translations/zh-CN/content/actions/automating-builds-and-tests/building-and-testing-nodejs-or-python.md file deleted because it no longer exists in main
54 translations/zh-CN/content/admin/code-security/managing-github-advanced-security-for-your-enterprise/deploying-github-advanced-security-in-your-enterprise.md file deleted because it no longer exists in main
55 translations/zh-CN/content/admin/code-security/managing-github-advanced-security-for-your-enterprise/overview-of-github-advanced-security-deployment.md file deleted because it no longer exists in main
56 translations/zh-CN/content/admin/configuration/configuring-your-enterprise/restricting-network-traffic-to-your-enterprise.md file deleted because it no longer exists in main
57 translations/zh-CN/content/admin/configuration/configuring-your-enterprise/troubleshooting-ssl-errors.md file deleted because it no longer exists in main
58 translations/zh-CN/content/admin/github-actions/enabling-github-actions-for-github-enterprise-server/enabling-github-actions-with-minio-gateway-for-nas-storage.md file deleted because it no longer exists in main
59 translations/zh-CN/content/admin/identity-and-access-management/authenticating-users-for-your-github-enterprise-server-instance/index.md file deleted because it no longer exists in main
230 translations/zh-CN/content/rest/reference/webhooks.md file deleted because it no longer exists in main
231 translations/zh-CN/content/site-policy/privacy-policies/github-data-protection-agreement.md file deleted because it no longer exists in main
232 translations/zh-CN/content/sponsors/receiving-sponsorships-through-github-sponsors/setting-up-github-sponsors-for-your-user-account.md file deleted because it no longer exists in main
233 translations/zh-CN/data/features/ip-allow-list-address-check.yml file deleted because it no longer exists in main
234 translations/zh-CN/data/features/security-overview-views.yml file deleted because it no longer exists in main
235 translations/zh-CN/data/glossaries/internal.yml file deleted because it no longer exists in main
236 translations/zh-CN/data/graphql/ghes-3.1/graphql_previews.enterprise.yml file deleted because it no longer exists in main
390 translations/zh-CN/data/reusables/dotcom_billing/pricing_calculator/pricing_cal_codespaces.md file deleted because it no longer exists in main
391 translations/zh-CN/data/reusables/education/upgrade-organization.md file deleted because it no longer exists in main
392 translations/zh-CN/data/reusables/education/upgrade-page.md file deleted because it no longer exists in main
393 translations/zh-CN/data/reusables/enterprise-accounts/oidc-beta-notice.md file deleted because it no longer exists in main
394 translations/zh-CN/data/reusables/enterprise-accounts/repository-visibility-policy.md file deleted because it no longer exists in main
395 translations/zh-CN/data/reusables/enterprise-licensing/you-can-sync-for-a-combined-view.md file deleted because it no longer exists in main
396 translations/zh-CN/data/reusables/enterprise_management_console/username_normalization_sample.md file deleted because it no longer exists in main
491 translations/zh-CN/content/actions/managing-workflow-runs/disabling-and-enabling-a-workflow.md rendering error
492 translations/zh-CN/content/actions/managing-workflow-runs/manually-running-a-workflow.md rendering error
493 translations/zh-CN/content/actions/managing-workflow-runs/re-running-workflows-and-jobs.md rendering error
494 translations/zh-CN/content/actions/migrating-to-github-actions/automating-migration-with-github-actions-importer.md rendering error
495 translations/zh-CN/content/actions/monitoring-and-troubleshooting-workflows/viewing-job-execution-time.md rendering error
496 translations/zh-CN/content/actions/publishing-packages/publishing-docker-images.md rendering error
497 translations/zh-CN/content/actions/publishing-packages/publishing-nodejs-packages.md broken liquid tags
503 translations/zh-CN/content/actions/using-github-hosted-runners/controlling-access-to-larger-runners.md rendering error
504 translations/zh-CN/content/actions/using-github-hosted-runners/using-larger-runners.md rendering error
505 translations/zh-CN/content/actions/using-workflows/about-workflows.md rendering error
translations/zh-CN/content/actions/using-workflows/caching-dependencies-to-speed-up-workflows.md broken liquid tags
506 translations/zh-CN/content/actions/using-workflows/creating-starter-workflows-for-your-organization.md rendering error
507 translations/zh-CN/content/actions/using-workflows/events-that-trigger-workflows.md rendering error
508 translations/zh-CN/content/actions/using-workflows/reusing-workflows.md rendering error
539 translations/zh-CN/content/admin/configuration/configuring-your-enterprise/configuring-web-commit-signing.md rendering error
540 translations/zh-CN/content/admin/configuration/configuring-your-enterprise/enabling-and-scheduling-maintenance-mode.md rendering error
541 translations/zh-CN/content/admin/configuration/configuring-your-enterprise/enabling-private-mode.md rendering error
translations/zh-CN/content/admin/configuration/configuring-your-enterprise/initializing-github-ae.md rendering error
542 translations/zh-CN/content/admin/configuration/configuring-your-enterprise/managing-github-mobile-for-your-enterprise.md rendering error
translations/zh-CN/content/admin/configuration/configuring-your-enterprise/restricting-network-traffic-to-your-enterprise.md broken liquid tags
543 translations/zh-CN/content/admin/configuration/configuring-your-enterprise/site-admin-dashboard.md rendering error
544 translations/zh-CN/content/admin/configuration/configuring-your-enterprise/troubleshooting-tls-errors.md rendering error
545 translations/zh-CN/content/admin/enterprise-management/caching-repositories/about-repository-caching.md rendering error
547 translations/zh-CN/content/admin/enterprise-management/caching-repositories/index.md rendering error
548 translations/zh-CN/content/admin/enterprise-management/configuring-clustering/cluster-network-configuration.md broken liquid tags
549 translations/zh-CN/content/admin/enterprise-management/configuring-clustering/configuring-high-availability-replication-for-a-cluster.md broken liquid tags
translations/zh-CN/content/admin/enterprise-management/configuring-clustering/initializing-the-cluster.md broken liquid tags
550 translations/zh-CN/content/admin/enterprise-management/monitoring-your-appliance/accessing-the-monitor-dashboard.md rendering error
551 translations/zh-CN/content/admin/enterprise-management/monitoring-your-appliance/configuring-collectd.md rendering error
552 translations/zh-CN/content/admin/enterprise-management/monitoring-your-appliance/generating-a-health-check-for-your-enterprise.md rendering error
559 translations/zh-CN/content/admin/enterprise-management/updating-the-virtual-machine-and-physical-resources/upgrading-github-enterprise-server.md rendering error
560 translations/zh-CN/content/admin/github-actions/advanced-configuration-and-troubleshooting/troubleshooting-github-actions-for-your-enterprise.md rendering error
561 translations/zh-CN/content/admin/github-actions/advanced-configuration-and-troubleshooting/using-a-staging-environment.md rendering error
562 translations/zh-CN/content/admin/github-actions/enabling-github-actions-for-github-enterprise-server/enabling-github-actions-with-minio-storage.md rendering error
563 translations/zh-CN/content/admin/github-actions/enabling-github-actions-for-github-enterprise-server/managing-self-hosted-runners-for-dependabot-updates.md rendering error
564 translations/zh-CN/content/admin/github-actions/getting-started-with-github-actions-for-your-enterprise/about-github-actions-for-enterprises.md rendering error
565 translations/zh-CN/content/admin/github-actions/getting-started-with-github-actions-for-your-enterprise/getting-started-with-github-actions-for-github-enterprise-server.md rendering error
566 translations/zh-CN/content/admin/github-actions/getting-started-with-github-actions-for-your-enterprise/getting-started-with-self-hosted-runners-for-your-enterprise.md rendering error
567 translations/zh-CN/content/admin/github-actions/getting-started-with-github-actions-for-your-enterprise/introducing-github-actions-to-your-enterprise.md rendering error
translations/zh-CN/content/admin/github-actions/getting-started-with-github-actions-for-your-enterprise/migrating-your-enterprise-to-github-actions.md broken liquid tags
568 translations/zh-CN/content/admin/github-actions/managing-access-to-actions-from-githubcom/about-using-actions-in-your-enterprise.md rendering error
569 translations/zh-CN/content/admin/identity-and-access-management/index.md broken liquid tags
570 translations/zh-CN/content/admin/identity-and-access-management/managing-iam-for-your-enterprise/changing-authentication-methods.md rendering error
576 translations/zh-CN/content/admin/identity-and-access-management/using-built-in-authentication/inviting-people-to-use-your-instance.md rendering error
577 translations/zh-CN/content/admin/identity-and-access-management/using-cas-for-enterprise-iam/index.md rendering error
578 translations/zh-CN/content/admin/identity-and-access-management/using-cas-for-enterprise-iam/using-cas.md rendering error
579 translations/zh-CN/content/admin/identity-and-access-management/using-enterprise-managed-users-for-iam/about-enterprise-managed-users.md broken liquid tags
580 translations/zh-CN/content/admin/identity-and-access-management/using-enterprise-managed-users-for-iam/about-support-for-your-idps-conditional-access-policy.md rendering error
581 translations/zh-CN/content/admin/identity-and-access-management/using-enterprise-managed-users-for-iam/configuring-oidc-for-enterprise-managed-users.md rendering error
582 translations/zh-CN/content/admin/identity-and-access-management/using-enterprise-managed-users-for-iam/configuring-saml-single-sign-on-for-enterprise-managed-users.md rendering error
584 translations/zh-CN/content/admin/identity-and-access-management/using-enterprise-managed-users-for-iam/migrating-from-saml-to-oidc.md rendering error
585 translations/zh-CN/content/admin/identity-and-access-management/using-ldap-for-enterprise-iam/index.md rendering error
586 translations/zh-CN/content/admin/identity-and-access-management/using-saml-for-enterprise-iam/about-saml-for-enterprise-iam.md rendering error
translations/zh-CN/content/admin/identity-and-access-management/using-saml-for-enterprise-iam/configuring-authentication-and-provisioning-for-your-enterprise-using-azure-ad.md broken liquid tags
587 translations/zh-CN/content/admin/identity-and-access-management/using-saml-for-enterprise-iam/configuring-saml-single-sign-on-for-your-enterprise.md broken liquid tags
588 translations/zh-CN/content/admin/identity-and-access-management/using-saml-for-enterprise-iam/enabling-encrypted-assertions.md rendering error
589 translations/zh-CN/content/admin/identity-and-access-management/using-saml-for-enterprise-iam/saml-configuration-reference.md broken liquid tags
613 translations/zh-CN/content/admin/packages/enabling-github-packages-with-minio.md rendering error
614 translations/zh-CN/content/admin/packages/getting-started-with-github-packages-for-your-enterprise.md rendering error
615 translations/zh-CN/content/admin/packages/migrating-your-enterprise-to-the-container-registry-from-the-docker-registry.md rendering error
translations/zh-CN/content/admin/packages/quickstart-for-configuring-your-minio-storage-bucket-for-github-packages.md rendering error
616 translations/zh-CN/content/admin/policies/enforcing-policies-for-your-enterprise/about-enterprise-policies.md broken liquid tags
617 translations/zh-CN/content/admin/policies/enforcing-policies-for-your-enterprise/enforcing-policies-for-github-actions-in-your-enterprise.md rendering error
618 translations/zh-CN/content/admin/policies/enforcing-policies-for-your-enterprise/enforcing-policies-for-security-settings-in-your-enterprise.md broken liquid tags
634 translations/zh-CN/content/admin/user-management/migrating-data-to-and-from-your-enterprise/migrating-data-to-your-enterprise.md rendering error
635 translations/zh-CN/content/authentication/authenticating-with-saml-single-sign-on/authorizing-a-personal-access-token-for-use-with-saml-single-sign-on.md rendering error
636 translations/zh-CN/content/authentication/authenticating-with-saml-single-sign-on/authorizing-an-ssh-key-for-use-with-saml-single-sign-on.md rendering error
translations/zh-CN/content/authentication/authenticating-with-saml-single-sign-on/viewing-and-managing-your-active-saml-sessions.md rendering error
637 translations/zh-CN/content/authentication/connecting-to-github-with-ssh/adding-a-new-ssh-key-to-your-github-account.md rendering error
638 translations/zh-CN/content/authentication/connecting-to-github-with-ssh/checking-for-existing-ssh-keys.md rendering error
639 translations/zh-CN/content/authentication/connecting-to-github-with-ssh/generating-a-new-ssh-key-and-adding-it-to-the-ssh-agent.md rendering error
642 translations/zh-CN/content/authentication/keeping-your-account-and-data-secure/authorizing-oauth-apps.md rendering error
643 translations/zh-CN/content/authentication/keeping-your-account-and-data-secure/creating-a-personal-access-token.md rendering error
644 translations/zh-CN/content/authentication/keeping-your-account-and-data-secure/creating-a-strong-password.md rendering error
translations/zh-CN/content/authentication/keeping-your-account-and-data-secure/index.md rendering error
645 translations/zh-CN/content/authentication/keeping-your-account-and-data-secure/preventing-unauthorized-access.md rendering error
646 translations/zh-CN/content/authentication/keeping-your-account-and-data-secure/removing-sensitive-data-from-a-repository.md rendering error
647 translations/zh-CN/content/authentication/keeping-your-account-and-data-secure/reviewing-your-deploy-keys.md rendering error
654 translations/zh-CN/content/authentication/managing-commit-signature-verification/associating-an-email-with-your-gpg-key.md rendering error
655 translations/zh-CN/content/authentication/managing-commit-signature-verification/displaying-verification-statuses-for-all-of-your-commits.md rendering error
656 translations/zh-CN/content/authentication/managing-commit-signature-verification/index.md broken liquid tags
657 translations/zh-CN/content/authentication/managing-commit-signature-verification/telling-git-about-your-signing-key.md broken liquid tags
658 translations/zh-CN/content/authentication/securing-your-account-with-two-factor-authentication-2fa/about-two-factor-authentication.md rendering error
659 translations/zh-CN/content/authentication/securing-your-account-with-two-factor-authentication-2fa/accessing-github-using-two-factor-authentication.md broken liquid tags
660 translations/zh-CN/content/authentication/securing-your-account-with-two-factor-authentication-2fa/configuring-two-factor-authentication.md rendering error
669 translations/zh-CN/content/billing/managing-billing-for-github-advanced-security/about-billing-for-github-advanced-security.md broken liquid tags
670 translations/zh-CN/content/billing/managing-billing-for-github-advanced-security/viewing-your-github-advanced-security-usage.md rendering error
671 translations/zh-CN/content/billing/managing-billing-for-github-codespaces/about-billing-for-github-codespaces.md rendering error
translations/zh-CN/content/billing/managing-billing-for-github-codespaces/index.md broken liquid tags
translations/zh-CN/content/billing/managing-billing-for-github-codespaces/viewing-your-github-codespaces-usage.md broken liquid tags
672 translations/zh-CN/content/billing/managing-billing-for-github-copilot/about-billing-for-github-copilot.md broken liquid tags
673 translations/zh-CN/content/billing/managing-billing-for-github-copilot/managing-your-github-copilot-subscription.md broken liquid tags
674 translations/zh-CN/content/billing/managing-billing-for-github-packages/about-billing-for-github-packages.md rendering error
724 translations/zh-CN/content/code-security/secret-scanning/protecting-pushes-with-secret-scanning.md rendering error
725 translations/zh-CN/content/code-security/secret-scanning/pushing-a-branch-blocked-by-push-protection.md rendering error
726 translations/zh-CN/content/code-security/security-advisories/global-security-advisories/about-the-github-advisory-database.md rendering error
727 translations/zh-CN/content/code-security/security-advisories/guidance-on-reporting-and-writing/managing-privately-reported-security-vulnerabilities.md rendering error
728 translations/zh-CN/content/code-security/security-advisories/repository-security-advisories/configuring-private-vulnerability-reporting-for-a-repository.md rendering error
729 translations/zh-CN/content/code-security/security-overview/about-the-security-overview.md rendering error
730 translations/zh-CN/content/code-security/security-overview/filtering-alerts-in-the-security-overview.md rendering error
733 translations/zh-CN/content/code-security/supply-chain-security/end-to-end-supply-chain/securing-code.md rendering error
734 translations/zh-CN/content/code-security/supply-chain-security/understanding-your-software-supply-chain/about-dependency-review.md rendering error
735 translations/zh-CN/content/code-security/supply-chain-security/understanding-your-software-supply-chain/about-the-dependency-graph.md rendering error
translations/zh-CN/content/code-security/supply-chain-security/understanding-your-software-supply-chain/configuring-dependency-review.md broken liquid tags
736 translations/zh-CN/content/code-security/supply-chain-security/understanding-your-software-supply-chain/configuring-the-dependency-graph.md broken liquid tags
translations/zh-CN/content/codespaces/codespaces-reference/disaster-recovery-for-github-codespaces.md broken liquid tags
737 translations/zh-CN/content/codespaces/codespaces-reference/security-in-github-codespaces.md broken liquid tags
translations/zh-CN/content/codespaces/codespaces-reference/using-github-copilot-in-github-codespaces.md broken liquid tags
738 translations/zh-CN/content/codespaces/codespaces-reference/using-the-vs-code-command-palette-in-codespaces.md broken liquid tags
739 translations/zh-CN/content/codespaces/customizing-your-codespace/changing-the-machine-type-for-your-codespace.md translations/zh-CN/content/codespaces/developing-in-codespaces/creating-a-codespace-for-a-repository.md broken liquid tags rendering error
740 translations/zh-CN/content/codespaces/customizing-your-codespace/configuring-automatic-deletion-of-your-codespaces.md translations/zh-CN/content/codespaces/developing-in-codespaces/creating-a-codespace-from-a-template.md broken liquid tags rendering error
741 translations/zh-CN/content/codespaces/customizing-your-codespace/personalizing-github-codespaces-for-your-account.md translations/zh-CN/content/codespaces/developing-in-codespaces/the-codespace-lifecycle.md broken liquid tags
translations/zh-CN/content/codespaces/customizing-your-codespace/renaming-a-codespace.md broken liquid tags
translations/zh-CN/content/codespaces/customizing-your-codespace/setting-your-default-editor-for-github-codespaces.md broken liquid tags
translations/zh-CN/content/codespaces/customizing-your-codespace/setting-your-timeout-period-for-github-codespaces.md broken liquid tags
translations/zh-CN/content/codespaces/developing-in-codespaces/connecting-to-a-private-network.md broken liquid tags
translations/zh-CN/content/codespaces/developing-in-codespaces/deleting-a-codespace.md broken liquid tags
translations/zh-CN/content/codespaces/developing-in-codespaces/developing-in-a-codespace.md broken liquid tags
translations/zh-CN/content/codespaces/developing-in-codespaces/forwarding-ports-in-your-codespace.md broken liquid tags
translations/zh-CN/content/codespaces/developing-in-codespaces/opening-an-existing-codespace.md broken liquid tags
translations/zh-CN/content/codespaces/developing-in-codespaces/stopping-and-starting-a-codespace.md broken liquid tags
translations/zh-CN/content/codespaces/developing-in-codespaces/using-github-codespaces-for-pull-requests.md broken liquid tags
translations/zh-CN/content/codespaces/developing-in-codespaces/using-github-codespaces-in-visual-studio-code.md rendering error
translations/zh-CN/content/codespaces/developing-in-codespaces/using-source-control-in-your-codespace.md broken liquid tags
translations/zh-CN/content/codespaces/getting-started/deep-dive.md broken liquid tags
translations/zh-CN/content/codespaces/getting-started/quickstart.md broken liquid tags
translations/zh-CN/content/codespaces/managing-codespaces-for-your-organization/enabling-github-codespaces-for-your-organization.md broken liquid tags
translations/zh-CN/content/codespaces/managing-codespaces-for-your-organization/index.md broken liquid tags
translations/zh-CN/content/codespaces/managing-codespaces-for-your-organization/listing-the-codespaces-in-your-organization.md broken liquid tags
translations/zh-CN/content/codespaces/managing-codespaces-for-your-organization/managing-repository-access-for-your-organizations-codespaces.md broken liquid tags
translations/zh-CN/content/codespaces/managing-codespaces-for-your-organization/restricting-access-to-machine-types.md broken liquid tags
translations/zh-CN/content/codespaces/managing-codespaces-for-your-organization/restricting-the-idle-timeout-period.md broken liquid tags
translations/zh-CN/content/codespaces/managing-codespaces-for-your-organization/restricting-the-retention-period-for-codespaces.md broken liquid tags
translations/zh-CN/content/codespaces/managing-codespaces-for-your-organization/restricting-the-visibility-of-forwarded-ports.md broken liquid tags
translations/zh-CN/content/codespaces/managing-codespaces-for-your-organization/reviewing-your-organizations-audit-logs-for-github-codespaces.md broken liquid tags
translations/zh-CN/content/codespaces/managing-your-codespaces/managing-encrypted-secrets-for-your-codespaces.md broken liquid tags
translations/zh-CN/content/codespaces/managing-your-codespaces/managing-gpg-verification-for-github-codespaces.md broken liquid tags
translations/zh-CN/content/codespaces/managing-your-codespaces/managing-repository-access-for-your-codespaces.md broken liquid tags
translations/zh-CN/content/codespaces/managing-your-codespaces/reviewing-your-security-logs-for-github-codespaces.md broken liquid tags
translations/zh-CN/content/codespaces/prebuilding-your-codespaces/about-github-codespaces-prebuilds.md broken liquid tags
742 translations/zh-CN/content/codespaces/prebuilding-your-codespaces/configuring-prebuilds.md rendering error
translations/zh-CN/content/codespaces/prebuilding-your-codespaces/managing-prebuilds.md broken liquid tags
translations/zh-CN/content/codespaces/prebuilding-your-codespaces/testing-dev-container-changes.md broken liquid tags
743 translations/zh-CN/content/codespaces/setting-up-your-project-for-codespaces/adding-a-codespaces-badge.md rendering error
744 translations/zh-CN/content/codespaces/setting-up-your-project-for-codespaces/introduction-to-dev-containers.md translations/zh-CN/content/codespaces/setting-up-your-project-for-codespaces/adding-features-to-a-devcontainer-file.md broken liquid tags
translations/zh-CN/content/codespaces/setting-up-your-project-for-codespaces/setting-a-minimum-specification-for-codespace-machines.md broken liquid tags
translations/zh-CN/content/codespaces/setting-up-your-project-for-codespaces/setting-up-your-dotnet-project-for-codespaces.md broken liquid tags
translations/zh-CN/content/codespaces/setting-up-your-project-for-codespaces/setting-up-your-java-project-for-codespaces.md broken liquid tags
translations/zh-CN/content/codespaces/setting-up-your-project-for-codespaces/setting-up-your-nodejs-project-for-codespaces.md broken liquid tags
translations/zh-CN/content/codespaces/setting-up-your-project-for-codespaces/setting-up-your-python-project-for-codespaces.md broken liquid tags
745 translations/zh-CN/content/codespaces/the-githubdev-web-based-editor.md rendering error
746 translations/zh-CN/content/codespaces/troubleshooting/exporting-changes-to-a-branch.md translations/zh-CN/content/codespaces/troubleshooting/troubleshooting-prebuilds.md broken liquid tags rendering error
translations/zh-CN/content/codespaces/troubleshooting/github-codespaces-logs.md broken liquid tags
translations/zh-CN/content/codespaces/troubleshooting/index.md broken liquid tags
translations/zh-CN/content/codespaces/troubleshooting/troubleshooting-creation-and-deletion-of-codespaces.md broken liquid tags
translations/zh-CN/content/codespaces/troubleshooting/troubleshooting-port-forwarding-for-github-codespaces.md broken liquid tags
translations/zh-CN/content/codespaces/troubleshooting/troubleshooting-prebuilds.md broken liquid tags
translations/zh-CN/content/codespaces/troubleshooting/troubleshooting-your-connection-to-github-codespaces.md broken liquid tags
translations/zh-CN/content/codespaces/troubleshooting/working-with-support-for-github-codespaces.md broken liquid tags
747 translations/zh-CN/content/communities/documenting-your-project-with-wikis/about-wikis.md rendering error
748 translations/zh-CN/content/communities/documenting-your-project-with-wikis/changing-access-permissions-for-wikis.md rendering error
749 translations/zh-CN/content/communities/documenting-your-project-with-wikis/editing-wiki-content.md rendering error
782 translations/zh-CN/content/discussions/managing-discussions-for-your-community/managing-categories-for-discussions.md rendering error
783 translations/zh-CN/content/discussions/managing-discussions-for-your-community/managing-discussions.md rendering error
784 translations/zh-CN/content/discussions/managing-discussions-for-your-community/moderating-discussions.md rendering error
translations/zh-CN/content/education/explore-the-benefits-of-teaching-and-learning-with-github-education/github-global-campus-for-students/about-github-global-campus-for-students.md broken liquid tags
translations/zh-CN/content/education/explore-the-benefits-of-teaching-and-learning-with-github-education/github-global-campus-for-teachers/about-github-global-campus-for-teachers.md broken liquid tags
785 translations/zh-CN/content/education/manage-coursework-with-github-classroom/get-started-with-github-classroom/glossary.md broken liquid tags
786 translations/zh-CN/content/education/manage-coursework-with-github-classroom/integrate-github-classroom-with-an-ide/about-using-makecode-arcade-with-github-classroom.md rendering error
787 translations/zh-CN/content/education/manage-coursework-with-github-classroom/integrate-github-classroom-with-an-ide/integrate-github-classroom-with-an-ide.md broken liquid tags
translations/zh-CN/content/education/manage-coursework-with-github-classroom/integrate-github-classroom-with-an-ide/using-github-codespaces-with-github-classroom.md broken liquid tags
788 translations/zh-CN/content/education/manage-coursework-with-github-classroom/learn-with-github-classroom/view-autograding-results.md rendering error
789 translations/zh-CN/content/education/manage-coursework-with-github-classroom/teach-with-github-classroom/create-a-group-assignment.md rendering error
790 translations/zh-CN/content/education/manage-coursework-with-github-classroom/teach-with-github-classroom/create-an-individual-assignment.md broken liquid tags
791 translations/zh-CN/content/education/manage-coursework-with-github-classroom/teach-with-github-classroom/manage-classrooms.md broken liquid tags
792 translations/zh-CN/content/education/manage-coursework-with-github-classroom/teach-with-github-classroom/use-the-git-and-github-starter-assignment.md broken liquid tags
793 translations/zh-CN/content/get-started/customizing-your-github-workflow/exploring-integrations/github-extensions-and-integrations.md rendering error
821 translations/zh-CN/content/get-started/signing-up-for-github/verifying-your-email-address.md rendering error
822 translations/zh-CN/content/get-started/using-git/about-git-rebase.md rendering error
823 translations/zh-CN/content/get-started/using-git/splitting-a-subfolder-out-into-a-new-repository.md rendering error
translations/zh-CN/content/get-started/using-github/github-command-palette.md rendering error
824 translations/zh-CN/content/get-started/using-github/github-mobile.md rendering error
825 translations/zh-CN/content/get-started/using-github/keyboard-shortcuts.md rendering error
826 translations/zh-CN/content/get-started/writing-on-github/getting-started-with-writing-and-formatting-on-github/about-writing-and-formatting-on-github.md broken liquid tags
827 translations/zh-CN/content/get-started/writing-on-github/getting-started-with-writing-and-formatting-on-github/basic-writing-and-formatting-syntax.md rendering error
828 translations/zh-CN/content/get-started/writing-on-github/getting-started-with-writing-and-formatting-on-github/quickstart-for-writing-on-github.md rendering error
829 translations/zh-CN/content/get-started/writing-on-github/working-with-advanced-formatting/about-task-lists.md rendering error
830 translations/zh-CN/content/get-started/writing-on-github/working-with-advanced-formatting/autolinked-references-and-urls.md broken liquid tags
831 translations/zh-CN/content/get-started/writing-on-github/working-with-advanced-formatting/writing-mathematical-expressions.md rendering error
832 translations/zh-CN/content/github-cli/github-cli/quickstart.md rendering error
844 translations/zh-CN/content/issues/organizing-your-work-with-project-boards/managing-project-boards/changing-project-board-visibility.md rendering error
845 translations/zh-CN/content/issues/organizing-your-work-with-project-boards/managing-project-boards/copying-a-project-board.md rendering error
846 translations/zh-CN/content/issues/organizing-your-work-with-project-boards/managing-project-boards/creating-a-project-board.md rendering error
translations/zh-CN/content/issues/planning-and-tracking-with-projects/learning-about-projects/about-projects.md broken liquid tags
847 translations/zh-CN/content/issues/tracking-your-work-with-issues/linking-a-pull-request-to-an-issue.md rendering error
848 translations/zh-CN/content/organizations/collaborating-with-groups-in-organizations/about-your-organizations-news-feed.md rendering error
849 translations/zh-CN/content/organizations/granting-access-to-your-organization-with-saml-single-sign-on/about-two-factor-authentication-and-saml-single-sign-on.md rendering error
850 translations/zh-CN/content/organizations/granting-access-to-your-organization-with-saml-single-sign-on/viewing-and-managing-a-members-saml-access-to-your-organization.md rendering error
851 translations/zh-CN/content/organizations/keeping-your-organization-secure/managing-security-settings-for-your-organization/accessing-compliance-reports-for-your-organization.md rendering error
852 translations/zh-CN/content/organizations/keeping-your-organization-secure/managing-security-settings-for-your-organization/managing-allowed-ip-addresses-for-your-organization.md broken liquid tags
853 translations/zh-CN/content/organizations/keeping-your-organization-secure/managing-security-settings-for-your-organization/managing-security-and-analysis-settings-for-your-organization.md rendering error
854 translations/zh-CN/content/organizations/keeping-your-organization-secure/managing-security-settings-for-your-organization/reviewing-the-audit-log-for-your-organization.md rendering error
855 translations/zh-CN/content/organizations/managing-git-access-to-your-organizations-repositories/about-ssh-certificate-authorities.md broken liquid tags
898 translations/zh-CN/content/pull-requests/collaborating-with-pull-requests/proposing-changes-to-your-work-with-pull-requests/keeping-your-pull-request-in-sync-with-the-base-branch.md rendering error
899 translations/zh-CN/content/pull-requests/collaborating-with-pull-requests/reviewing-changes-in-pull-requests/reviewing-dependency-changes-in-a-pull-request.md rendering error
900 translations/zh-CN/content/pull-requests/collaborating-with-pull-requests/reviewing-changes-in-pull-requests/reviewing-proposed-changes-in-a-pull-request.md rendering error
translations/zh-CN/content/pull-requests/collaborating-with-pull-requests/working-with-forks/about-forks.md broken liquid tags
901 translations/zh-CN/content/pull-requests/collaborating-with-pull-requests/working-with-forks/syncing-a-fork.md rendering error
902 translations/zh-CN/content/pull-requests/committing-changes-to-your-project/creating-and-editing-commits/changing-a-commit-message.md rendering error
903 translations/zh-CN/content/pull-requests/committing-changes-to-your-project/creating-and-editing-commits/creating-a-commit-on-behalf-of-an-organization.md rendering error
970 translations/zh-CN/content/rest/projects/projects.md broken liquid tags
971 translations/zh-CN/content/rest/scim.md rendering error
972 translations/zh-CN/content/rest/teams/team-sync.md rendering error
translations/zh-CN/content/search-github/getting-started-with-searching-on-github/about-searching-on-github.md rendering error
973 translations/zh-CN/content/search-github/getting-started-with-searching-on-github/enabling-githubcom-repository-search-from-your-private-enterprise-environment.md rendering error
translations/zh-CN/content/search-github/searching-on-github/searching-code.md broken liquid tags
974 translations/zh-CN/content/search-github/searching-on-github/searching-for-repositories.md rendering error
975 translations/zh-CN/content/sponsors/receiving-sponsorships-through-github-sponsors/managing-your-sponsorship-tiers.md broken liquid tags
976 translations/zh-CN/content/sponsors/receiving-sponsorships-through-github-sponsors/setting-up-github-sponsors-for-your-organization.md rendering error
1030 translations/zh-CN/data/reusables/actions/settings-ui/settings-actions-runner-groups.md rendering error
1031 translations/zh-CN/data/reusables/actions/settings-ui/settings-actions-runners.md rendering error
1032 translations/zh-CN/data/reusables/actions/sidebar-secret.md rendering error
1033 translations/zh-CN/data/reusables/actions/supported-github-runners.md broken liquid tags
1034 translations/zh-CN/data/reusables/actions/upgrade-runners-before-upgrade-ghes.md rendering error
1035 translations/zh-CN/data/reusables/actions/workflow-basic-example-and-explanation.md rendering error
1036 translations/zh-CN/data/reusables/actions/workflow-dispatch-inputs.md rendering error
1055 translations/zh-CN/data/reusables/code-scanning/licensing-note.md broken liquid tags
1056 translations/zh-CN/data/reusables/code-scanning/run-additional-queries.md broken liquid tags
1057 translations/zh-CN/data/reusables/code-scanning/what-is-codeql-cli.md rendering error
translations/zh-CN/data/reusables/codespaces/codespaces-disabling-org-billing.md broken liquid tags
translations/zh-CN/data/reusables/codespaces/codespaces-spending-limit-requirement.md broken liquid tags
translations/zh-CN/data/reusables/codespaces/creating-a-codespace-in-vscode.md rendering error
1058 translations/zh-CN/data/reusables/codespaces/customize-vcpus-and-ram.md broken liquid tags
1059 translations/zh-CN/data/reusables/codespaces/next-steps-adding-devcontainer.md broken liquid tags
1060 translations/zh-CN/data/reusables/codespaces/prebuilds-crossreference.md broken liquid tags
1061 translations/zh-CN/data/reusables/codespaces/rebuild-command.md broken liquid tags
1062 translations/zh-CN/data/reusables/codespaces/secrets-on-start.md broken liquid tags
translations/zh-CN/data/reusables/codespaces/use-chrome.md broken liquid tags
1063 translations/zh-CN/data/reusables/command_line/provide-an-access-token.md broken liquid tags
1064 translations/zh-CN/data/reusables/copilot/install-copilot-in-neovim.md broken liquid tags
1065 translations/zh-CN/data/reusables/dependabot/beta-security-and-version-updates.md rendering error
1066 translations/zh-CN/data/reusables/dependabot/default-dependencies-allow-ignore.md broken liquid tags
1067 translations/zh-CN/data/reusables/dependabot/dependabot-alerts-dependency-scope.md broken liquid tags
1068 translations/zh-CN/data/reusables/dependabot/dependabot-alerts-filters.md rendering error
1069 translations/zh-CN/data/reusables/dependabot/enabling-disabling-dependency-graph-private-repo.md rendering error
1070 translations/zh-CN/data/reusables/dependabot/sidebar-secret.md rendering error
1071 translations/zh-CN/data/reusables/dependabot/supported-package-managers.md rendering error
1078 translations/zh-CN/data/reusables/enterprise-accounts/actions-packages-report-download-enterprise-accounts.md broken liquid tags
1079 translations/zh-CN/data/reusables/enterprise-accounts/billing-microsoft-ea-overview.md broken liquid tags
1080 translations/zh-CN/data/reusables/enterprise-accounts/dormant-user-activity.md rendering error
1081 translations/zh-CN/data/reusables/enterprise-accounts/emu-azure-admin-consent.md broken liquid tags
1082 translations/zh-CN/data/reusables/enterprise-accounts/emu-cap-validates.md broken liquid tags
1083 translations/zh-CN/data/reusables/enterprise-accounts/emu-forks.md rendering error
1084 translations/zh-CN/data/reusables/enterprise-accounts/emu-permission-follow.md broken liquid tags
1121 translations/zh-CN/data/reusables/getting-started/enterprise-advanced-security.md broken liquid tags
1122 translations/zh-CN/data/reusables/getting-started/managing-enterprise-members.md rendering error
1123 translations/zh-CN/data/reusables/git/git-push.md rendering error
1124 translations/zh-CN/data/reusables/identity-and-permissions/ip-allow-lists-enable.md translations/zh-CN/data/reusables/identity-and-permissions/about-adding-ip-allow-list-entries.md broken liquid tags
1125 translations/zh-CN/data/reusables/identity-and-permissions/about-editing-ip-allow-list-entries.md broken liquid tags
1126 translations/zh-CN/data/reusables/identity-and-permissions/about-enabling-allowed-ip-addresses.md broken liquid tags
1127 translations/zh-CN/data/reusables/identity-and-permissions/ip-allow-lists-githubapps-enterprise.md broken liquid tags
1128 translations/zh-CN/data/reusables/identity-and-permissions/vigilant-mode-beta-note.md rendering error
1129 translations/zh-CN/data/reusables/large_files/storage_assets_location.md broken liquid tags
1130 translations/zh-CN/data/reusables/large_files/use_lfs_tip.md rendering error
1151 translations/zh-CN/data/reusables/pages/sidebar-pages.md rendering error
1152 translations/zh-CN/data/reusables/projects/enable-basic-workflow.md broken liquid tags
1153 translations/zh-CN/data/reusables/projects/graphql-ghes.md rendering error
translations/zh-CN/data/reusables/projects/projects-filters.md broken liquid tags
1154 translations/zh-CN/data/reusables/pull_requests/configure_pull_request_merges_intro.md rendering error
1155 translations/zh-CN/data/reusables/pull_requests/default_merge_option.md rendering error
1156 translations/zh-CN/data/reusables/pull_requests/pull_request_merges_and_contributions.md rendering error

View File

@@ -0,0 +1,240 @@
---
title: Automating migration with GitHub Actions Importer
intro: 'Use {% data variables.product.prodname_actions_importer %} to plan and automate your migration to {% data variables.product.prodname_actions %}.'
versions:
fpt: '*'
ghec: '*'
ghes: '*'
ghae: '*'
type: how_to
miniTocMaxHeadingLevel: 3
topics:
- Migration
- CI
- CD
shortTitle: Automate migration with {% data variables.product.prodname_actions_importer %}
---
{% data reusables.actions.enterprise-beta %}
{% data reusables.actions.enterprise-github-hosted-runners %}
[Legal notice](#legal-notice)
{% note %}
**Note**: {% data variables.product.prodname_actions_importer %} is currently available as a public preview. Visit the [sign up page](https://github.com/features/actions-importer/signup) to request access to the preview. Once you are granted access you'll be able to use the `gh-actions-importer` CLI extension
{% endnote %}
## About {% data variables.product.prodname_actions_importer %}
You can use {% data variables.product.prodname_actions_importer %} to plan and automatically migrate your CI/CD pipelines to {% data variables.product.prodname_actions %} from Azure DevOps, CircleCI, GitLab, Jenkins, and Travis CI.
{% data variables.product.prodname_actions_importer %} is distributed as a Docker container, and uses a [{% data variables.product.prodname_dotcom %} CLI](https://cli.github.com) extension to interact with the container.
Any workflow that is converted by the {% data variables.product.prodname_actions_importer %} should be inspected for correctness before using it as a production workload. The goal is to achieve an 80% conversion rate for every workflow, however, the actual conversion rate will depend on the makeup of each individual pipeline that is converted.
## Supported CI platforms
You can use {% data variables.product.prodname_actions_importer %} to migrate from the following platforms:
- Azure DevOps
- CircleCI
- GitLab
- Jenkins
- Travis CI
Once you are granted access to the preview, you will be able to access further reference documentation for each of the supported platforms.
## Prerequisites
{% data variables.product.prodname_actions_importer %} has the following requirements:
- You must have been granted access to the public preview for the {% data variables.product.prodname_actions_importer %}.
{%- ifversion ghes < 3.5 or ghae %}
- Use a {% data variables.product.pat_generic %} with the `read:packages` scope enabled.
{%- else %}
- You must have credentials to authenticate to the {% data variables.product.prodname_registry %} {% data variables.product.prodname_container_registry %}. For more information, see "[Working with the Container registry](/packages/working-with-a-github-packages-registry/working-with-the-container-registry#authenticating-to-the-container-registry)."
{% endif %}
- An environment where you can run Linux-based containers, and can install the necessary tools.
- Docker is [installed](https://docs.docker.com/get-docker/) and running.
- [{% data variables.product.prodname_dotcom %} CLI](https://cli.github.com) is installed.
{% note %}
**Note**: The {% data variables.product.prodname_actions_importer %} container and CLI do not need to be installed on the same server as your CI platform.
{% endnote %}
### Installing the {% data variables.product.prodname_actions_importer %} CLI extension
1. Install the {% data variables.product.prodname_actions_importer %} CLI extension:
```bash
$ gh extension install github/gh-actions-importer
```
1. Verify that the extension is installed:
```bash
$ gh actions-importer -h
Options:
-?, -h, --help Show help and usage information
Commands:
update Update to the latest version of the GitHub Actions Importer.
version Display the version of the GitHub Actions Importer.
configure Start an interactive prompt to configure credentials used to authenticate with your CI server(s).
audit Plan your CI/CD migration by analyzing your current CI/CD footprint.
forecast Forecast GitHub Actions usage from historical pipeline utilization.
dry-run Convert a pipeline to a GitHub Actions workflow and output its yaml file.
migrate Convert a pipeline to a GitHub Actions workflow and open a pull request with the changes.
```
### Updating the {% data variables.product.prodname_actions_importer %} CLI
To ensure you're running the latest version of {% data variables.product.prodname_actions_importer %}, you should regularly run the `update` command:
```bash
$ gh actions-importer update
```
You must be authenticated with the {% data variables.product.prodname_container_registry %} for this command to be successful. Alternatively, you can provide credentials using the `--username` and `--password-stdin` parameters:
```bash
$ echo $GITHUB_TOKEN | gh actions-importer update --username $GITHUB_HANDLE --password-stdin
```
### Authenticating at the command line
You must configure credentials that allow {% data variables.product.prodname_actions_importer %} to communicate with {% data variables.product.prodname_dotcom %} and your current CI server. You can configure these credentials using environment variables or a `.env.local` file. The environment variables can be configured in an interactive prompt, by running the following command:
```bash
$ gh actions-importer configure
```
Once you are granted access to the preview, you will be able to access further reference documentation about using environment variables.
## Using the {% data variables.product.prodname_actions_importer %} CLI
Use the subcommands of `gh actions-importer` to begin your migration to {% data variables.product.prodname_actions %}, including `audit`, `forecast`, `dry-run`, and `migrate`.
### Auditing your existing CI pipelines
The `audit` subcommand can be used to plan your CI/CD migration by analyzing your current CI/CD footprint. This analysis can be used to plan a timeline for migrating to {% data variables.product.prodname_actions %}.
To run an audit, use the following command to determine your available options:
```bash
$ gh actions-importer audit -h
Description:
Plan your CI/CD migration by analyzing your current CI/CD footprint.
[...]
Commands:
azure-devops An audit will output a list of data used in an Azure DevOps instance.
circle-ci An audit will output a list of data used in a CircleCI instance.
gitlab An audit will output a list of data used in a GitLab instance.
jenkins An audit will output a list of data used in a Jenkins instance.
travis-ci An audit will output a list of data used in a Travis CI instance.
```
Once you are granted access to the preview, you will be able to access further reference documentation about running an audit.
### Forecasting usage
The `forecast` subcommand reviews historical pipeline usage to create a forecast of {% data variables.product.prodname_actions %} usage.
To run a forecast, use the following command to determine your available options:
```bash
$ gh actions-importer forecast -h
Description:
Forecasts GitHub Actions usage from historical pipeline utilization.
[...]
Commands:
azure-devops Forecasts GitHub Actions usage from historical Azure DevOps pipeline utilization.
jenkins Forecasts GitHub Actions usage from historical Jenkins pipeline utilization.
gitlab Forecasts GitHub Actions usage from historical GitLab pipeline utilization.
circle-ci Forecasts GitHub Actions usage from historical CircleCI pipeline utilization.
travis-ci Forecasts GitHub Actions usage from historical Travis CI pipeline utilization.
github Forecasts GitHub Actions usage from historical GitHub pipeline utilization.
```
Once you are granted access to the preview, you will be able to access further reference documentation about running a forecast.
### Testing the migration process
The `dry-run` subcommand can be used to convert a pipeline to its {% data variables.product.prodname_actions %} equivalent, and then write the workflow to your local filesystem.
To perform a dry run, use the following command to determine your available options:
```bash
$ gh actions-importer dry-run -h
Description:
Convert a pipeline to a GitHub Actions workflow and output its yaml file.
[...]
Commands:
azure-devops Convert an Azure DevOps pipeline to a GitHub Actions workflow and output its yaml file.
circle-ci Convert a CircleCI pipeline to GitHub Actions workflows and output the yaml file(s).
gitlab Convert a GitLab pipeline to a GitHub Actions workflow and output the yaml file.
jenkins Convert a Jenkins job to a GitHub Actions workflow and output its yaml file.
travis-ci Convert a Travis CI pipeline to a GitHub Actions workflow and output its yaml file.
```
Once you are granted access to the preview, you will be able to access further reference documentation about performing a dry run.
### Migrating a pipeline to {% data variables.product.prodname_actions %}
The `migrate` subcommand can be used to convert a pipeline to its GitHub Actions equivalent and then create a pull request with the contents.
To run a migration, use the following command to determine your available options:
```bash
$ gh actions-importer migrate -h
Description:
Convert a pipeline to a GitHub Actions workflow and open a pull request with the changes.
[...]
Commands:
azure-devops Convert an Azure DevOps pipeline to a GitHub Actions workflow and open a pull request with the changes.
circle-ci Convert a CircleCI pipeline to GitHub Actions workflows and open a pull request with the changes.
gitlab Convert a GitLab pipeline to a GitHub Actions workflow and open a pull request with the changes.
jenkins Convert a Jenkins job to a GitHub Actions workflow and open a pull request with the changes.
travis-ci Convert a Travis CI pipeline to a GitHub Actions workflow and and open a pull request with the changes.
```
Once you are granted access to the preview, you will be able to access further reference documentation about running a migration.
## Legal notice
Portions have been adapted from https://github.com/github/gh-actions-importer/ under the MIT license:
```
MIT License
Copyright (c) 2022 GitHub
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
```

View File

@@ -111,7 +111,8 @@ Workflow logs list the runner used to run a job. For more information, see "[Vie
## Supported software
The software tools included in {% data variables.product.prodname_dotcom %}-hosted runners are updated weekly. The update process takes several days, and the list of preinstalled software on the `main` branch is updated after the whole deployment ends.
The software tools included in {% data variables.product.prodname_dotcom %}-hosted runners are updated weekly. The update process takes several days, and the list of preinstalled software on the `main` branch is updated after the whole deployment ends.
### Preinstalled software
Workflow logs include a link to the preinstalled tools on the exact runner. To find this information in the workflow log, expand the `Set up job` section. Under that section, expand the `Runner Image` section. The link following `Included Software` will describe the preinstalled tools on the runner that ran the workflow.

View File

@@ -1,7 +1,7 @@
---
title: Caching dependencies to speed up workflows
title: 缓存依赖项以加快工作流程
shortTitle: Cache dependencies
intro: 'To make your workflows faster and more efficient, you can create and use caches for dependencies and other commonly reused files.'
intro: 为了使工作流程更快、更高效,可以为依赖项及其他经常重复使用的文件创建和使用缓存。
redirect_from:
- /github/automating-your-workflow-with-github-actions/caching-dependencies-to-speed-up-workflows
- /actions/automating-your-workflow-with-github-actions/caching-dependencies-to-speed-up-workflows
@@ -14,65 +14,69 @@ type: tutorial
topics:
- Workflows
miniTocMaxHeadingLevel: 3
ms.openlocfilehash: 380fe568e950a4dc388e8f811ecebd12f242c5df
ms.sourcegitcommit: 34d500fe45b362043b4b4685d6705a7bfb484d11
ms.translationtype: HT
ms.contentlocale: zh-CN
ms.lasthandoff: 11/15/2022
ms.locfileid: '148164378'
---
## 关于缓存工作流程依赖项
## About caching workflow dependencies
工作流程运行通常在不同运行之间重新使用相同的输出或下载的依赖项。 例如Maven、Gradle、npm 和 Yarn 等软件包和依赖项管理工具都会对下载的依赖项保留本地缓存。
Workflow runs often reuse the same outputs or downloaded dependencies from one run to another. For example, package and dependency management tools such as Maven, Gradle, npm, and Yarn keep a local cache of downloaded dependencies.
{% data variables.product.prodname_dotcom %} 托管的运行器上的 {% ifversion fpt or ghec %} 作业在干净的运行器映像中启动,每次都必须下载依赖项,导致网络利用率提高、运行时间延长和成本增加。 {% endif %}为帮助加快重新创建依赖项等文件,{% data variables.product.prodname_dotcom %} 可以缓存你在工作流中经常使用的文件。
{% ifversion fpt or ghec %} Jobs on {% data variables.product.prodname_dotcom %}-hosted runners start in a clean runner image and must download dependencies each time, causing increased network utilization, longer runtime, and increased cost. {% endif %}To help speed up the time it takes to recreate files like dependencies, {% data variables.product.prodname_dotcom %} can cache files you frequently use in workflows.
要缓存作业的依赖项,可以使用 {% data variables.product.prodname_dotcom %} 的 [`cache` 操作](https://github.com/actions/cache)。 该操作创建和还原由唯一键标识的缓存。 或者,如果要缓存下列包管理器,则使用其各自的 setup-* 操作需要最小配置并将为你创建和还原依赖项缓存。
To cache dependencies for a job, you can use {% data variables.product.prodname_dotcom %}'s [`cache` action](https://github.com/actions/cache). The action creates and restores a cache identified by a unique key. Alternatively, if you are caching the package managers listed below, using their respective setup-* actions requires minimal configuration and will create and restore dependency caches for you.
| Package managers | setup-* action for caching |
| 包管理器 | 用于缓存的 setup-* 操作 |
|---|---|
| npm, Yarn, pnpm | [setup-node](https://github.com/actions/setup-node#caching-global-packages-data) |
| pip, pipenv, Poetry | [setup-python](https://github.com/actions/setup-python#caching-packages-dependencies) |
| Gradle, Maven | [setup-java](https://github.com/actions/setup-java#caching-packages-dependencies) |
| npmYarnpnpm | [setup-node](https://github.com/actions/setup-node#caching-global-packages-data) |
| pippipenvPoetry | [setup-python](https://github.com/actions/setup-python#caching-packages-dependencies) |
| GradleMaven | [setup-java](https://github.com/actions/setup-java#caching-packages-dependencies) |
| RubyGems | [setup-ruby](https://github.com/ruby/setup-ruby#caching-bundle-install-automatically) |
| Go `go.sum` | [setup-go](https://github.com/actions/setup-go#caching-dependency-files-and-build-outputs) |
{% warning %}
**Warning**: {% ifversion fpt or ghec %}Be mindful of the following when using caching with {% data variables.product.prodname_actions %}:
警告:{% ifversion fpt or ghec %}将缓存与 {% data variables.product.prodname_actions %} 结合使用时,请注意以下几点:
* {% endif %}We recommend that you don't store any sensitive information in the cache. For example, sensitive information can include access tokens or login credentials stored in a file in the cache path. Also, command line interface (CLI) programs like `docker login` can save access credentials in a configuration file. Anyone with read access can create a pull request on a repository and access the contents of a cache. Forks of a repository can also create pull requests on the base branch and access caches on the base branch.
* {% endif %}建议不要在缓存中存储任何敏感信息。 例如,敏感信息可以包括存储在缓存路径的文件中的访问令牌或登录凭据。 此外,命令行接口 (CLI) 程序(例如 `docker login`)可以将访问凭据保存在配置文件中。 具有读取访问权限的任何人都可以在存储库上创建拉取请求并访问缓存的内容。 仓库的复刻也可在基本分支上创建拉取请求,并在基本分支上访问缓存。
{%- ifversion fpt or ghec %}
* When using self-hosted runners, caches from workflow runs are stored on {% data variables.product.company_short %}-owned cloud storage. A customer-owned storage solution is only available with {% data variables.product.prodname_ghe_server %}.
* 使用自托管运行器时,工作流运行中的缓存存储在 {% data variables.product.company_short %} 拥有的云存储上。 客户拥有的存储解决方案仅适用于 {% data variables.product.prodname_ghe_server %}
{%- endif %}
{% endwarning %}
{% data reusables.actions.comparing-artifacts-caching %}
For more information on workflow run artifacts, see "[Persisting workflow data using artifacts](/github/automating-your-workflow-with-github-actions/persisting-workflow-data-using-artifacts)."
有关工作流运行工件的详细信息,请参阅“[使用工件持久保存工作流数据](/github/automating-your-workflow-with-github-actions/persisting-workflow-data-using-artifacts)”。
## Restrictions for accessing a cache
## 访问缓存的限制
Access restrictions provide cache isolation and security by creating a logical boundary between different branches or tags.
Workflow runs can restore caches created in either the current branch or the default branch (usually `main`). If a workflow run is triggered for a pull request, it can also restore caches created in the base branch, including base branches of forked repositories. For example, if the branch `feature-b` has the base branch `feature-a`, a workflow run triggered on a pull request would have access to caches created in the default `main` branch, the base `feature-a` branch, and the current `feature-b` branch.
访问限制通过在不同分支或标记之间创建逻辑边界来提供缓存隔离和安全性。 工作流运行可以还原在当前分支或默认分支(通常是 `main`)中创建的缓存。 如果为拉取请求触发了工作流运行,则它还可以还原在基分支中创建的缓存,包括分支存储库的基分支。 例如,如果分支 `feature-b` 具有基分支 `feature-a`,则对拉取请求触发的工作流运行将有权访问在默认 `main` 分支、`feature-a` 基分支和当前 `feature-b` 分支中创建的缓存。
Workflow runs cannot restore caches created for child branches or sibling branches. For example, a cache created for the child `feature-b` branch would not be accessible to a workflow run triggered on the parent `main` branch. Similarly, a cache created for the `feature-a` branch with the base `main` would not be accessible to its sibling `feature-c` branch with the base `main`. Workflow runs also cannot restore caches created for different tag names. For example, a cache created for the tag `release-a` with the base `main` would not be accessible to a workflow run triggered for the tag `release-b` with the base `main`.
工作流运行无法还原为子分支或同级分支创建的缓存。 例如,在父分支 `feature-b` 上触发的工作流运行无法访问为子分支 `main` 创建的缓存。 例如,为 `feature-a` 分支(基分支为 `main`)创建的缓存无法供其同级 `feature-c` 分支(基分支为 `main`)访问。 工作流运行也不能还原为不同标记名称创建的缓存。 例如,针对标记 `release-b`(基分支为 `main`)触发的工作流无法访问为标记 `release-a`(基分支为 `main`)创建的缓存。
When a cache is created by a workflow run triggered on a pull request, the cache is created for the merge ref (`refs/pull/.../merge`). Because of this, the cache will have a limited scope and can only be restored by re-runs of the pull request. It cannot be restored by the base branch or other pull requests targeting that base branch.
当缓存由对拉取请求触发的工作流运行创建时,会为合并引用 (`refs/pull/.../merge`) 创建缓存。 因此,缓存的范围有限,只能通过重新运行拉取请求来还原。 它不能由基分支或针对该基分支的其他拉取请求还原。
Multiple workflow runs in a repository can share caches. A cache created for a branch in a workflow run can be accessed and restored from another workflow run for the same repository and branch.
存储库中的多个工作流运行可以共享缓存。 可以从同一存储库和分支的另一个工作流运行访问和还原为工作流运行中的分支创建的缓存。
## Using the `cache` action
## 使用 `cache` 操作
The [`cache` action](https://github.com/actions/cache) will attempt to restore a cache based on the `key` you provide. When the action finds a cache that _exactly_ matches the key, the action restores the cached files to the `path` you configure.
You can optionally provide a list of `restore-keys` to use in case the `key` doesn't match an existing cache. A list of `restore-keys` is useful when you are restoring a cache from another branch because `restore-keys` can _partially_ match cache keys. For more information about matching `restore-keys`, see "[Matching a cache key](#matching-a-cache-key)."
[`cache` 操作](https://github.com/actions/cache)将尝试根据你提供 `key` 的还原缓存。 当操作找到与键完全匹配的缓存时,该操作会将缓存的文件还原到你配置的 `path`
可以选择提供在 `key` 与现有缓存不匹配时要使用的 `restore-keys` 列表。 从另一个分支还原缓存时,`restore-keys` 列表非常有用,因为 `restore-keys` 可以部分匹配缓存键。 有关匹配 `restore-keys` 的详细信息,请参阅“[匹配缓存密钥](#matching-a-cache-key)”。
If there is an exact match to the provided `key`, this is considered a cache hit. If no cache exactly matches the provided `key`, this is considered a cache miss. On a cache miss, the action automatically creates a new cache if the job completes successfully. The new cache will use the `key` you provided and contains the files you specify in `path`. For more information about how this is handled, see "[Cache hits and misses](#cache-hits-and-misses)."
如果与提供的 `key` 完全匹配,则这被视为缓存命中。 如果没有缓存与提供的 `key` 完全匹配,则这被视为缓存失误。 在缓存失误情况下,该操作会在作业成功完成时自动创建一个新缓存。 新缓存将使用你提供的 `key`,并包含你在 `path` 中指定的文件。 有关如何处理此问题的详细信息,请参阅“[缓存命中和缓存失误](#cache-hits-and-misses)”。
You cannot change the contents of an existing cache. Instead, you can create a new cache with a new key.
不能更改现有缓存的内容。 相反,可以使用新键创建新缓存。
### Input parameters for the `cache` action
### `cache` 操作的输入参数
- `key`: **Required** The key created when saving a cache and the key used to search for a cache. It can be any combination of variables, context values, static strings, and functions. Keys have a maximum length of 512 characters, and keys longer than the maximum length will cause the action to fail.
- `path`: **Required** The path(s) on the runner to cache or restore.
- You can specify a single path, or you can add multiple paths on separate lines. For example:
- `key`:必要。保存缓存时创建的密钥和用于搜索缓存的密钥。 它可以是变量、上下文值、静态字符串和函数的任何组合。 密钥最大长度为 512 个字符,密钥长度超过最大长度将导致操作失败。
- `path`:必要。运行器上用于缓存或还原的路径。
- 可以指定单个路径,也可以在单独的行上添加多个路径。 例如:
```
- name: Cache Gradle packages
@@ -82,9 +86,9 @@ You cannot change the contents of an existing cache. Instead, you can create a n
~/.gradle/caches
~/.gradle/wrapper
```
- You can specify either directories or single files, and glob patterns are supported.
- You can specify absolute paths, or paths relative to the workspace directory.
- `restore-keys`: **Optional** A string containing alternative restore keys, with each restore key placed on a new line. If no cache hit occurs for `key`, these restore keys are used sequentially in the order provided to find and restore a cache. For example:
- 可以指定目录或单个文件,并且支持 glob 模式。
- 可以指定绝对路径或相对于工作区目录的路径。
- `restore-keys`:可选。包含备用还原键的字符串,每个还原键均放置在一个新行上。 如果 `key` 没有发生缓存命中,则按照提供的顺序依次使用这些还原键来查找和还原缓存。 例如:
{% raw %}
```yaml
@@ -95,28 +99,28 @@ You cannot change the contents of an existing cache. Instead, you can create a n
```
{% endraw %}
### Output parameters for the `cache` action
### `cache` 操作的输出参数
- `cache-hit`: A boolean value to indicate an exact match was found for the key.
- `cache-hit`:表示找到了键的精确匹配项的布尔值。
### Cache hits and misses
When `key` exactly matches an existing cache, it's called a _cache hit_, and the action restores the cached files to the `path` directory.
### 缓存命中和缓存失误
`key` 完全匹配现有缓存时,被称为缓存命中,并且操作会将缓存的文件还原到 `path` 目录。
When `key` doesn't match an existing cache, it's called a _cache miss_, and a new cache is automatically created if the job completes successfully.
`key` 不匹配现有缓存时,则被称为缓存失误,在作业成功完成时会自动创建一个新缓存。
When a cache miss occurs, the action also searches your specified `restore-keys` for any matches:
发生缓存失误时,该操作还会搜索指定的 `restore-keys` 以查找任何匹配项:
1. If you provide `restore-keys`, the `cache` action sequentially searches for any caches that match the list of `restore-keys`.
- When there is an exact match, the action restores the files in the cache to the `path` directory.
- If there are no exact matches, the action searches for partial matches of the restore keys. When the action finds a partial match, the most recent cache is restored to the `path` directory.
1. The `cache` action completes and the next step in the job runs.
1. If the job completes successfully, the action automatically creates a new cache with the contents of the `path` directory.
1. 如果提供 `restore-keys``cache` 操作将按顺序搜索与 `restore-keys` 列表匹配的任何缓存。
- 当存在精确匹配时,该操作会将缓存中的文件还原到 `path` 目录。
- 如果没有精确匹配,操作将会搜索恢复键值的部分匹配。 当操作找到部分匹配时,最近的缓存将还原到 `path` 目录。
1. `cache` 操作完成,作业中的下一个步骤运行。
1. 如果作业成功完成,则操作将自动创建一个包含 `path` 目录内容的新缓存。
For a more detailed explanation of the cache matching process, see "[Matching a cache key](#matching-a-cache-key)."
有关缓存匹配过程的更详细说明,请参阅“[匹配缓存键](#matching-a-cache-key)”。
### Example using the `cache` action
### 使用 `cache` 操作的示例
This example creates a new cache when the packages in `package-lock.json` file change, or when the runner's operating system changes. The cache key uses contexts and expressions to generate a key that includes the runner's operating system and a SHA-256 hash of the `package-lock.json` file.
此示例在 `package-lock.json` 文件中的包更改时,或运行器的操作系统更改时,创建一个新的缓存。 缓存键使用上下文和表达式生成一个键值,其中包括运行器的操作系统和 `package-lock.json` 文件的 SHA-256 哈希。
```yaml{:copy}
name: Caching with npm
@@ -156,13 +160,13 @@ jobs:
run: npm test
```
### Using contexts to create cache keys
### 使用上下文创建缓存键
A cache key can include any of the contexts, functions, literals, and operators supported by {% data variables.product.prodname_actions %}. For more information, see "[Contexts](/actions/learn-github-actions/contexts)" and "[Expressions](/actions/learn-github-actions/expressions)."
缓存键可以包括 {% data variables.product.prodname_actions %} 支持的任何上下文、函数、文本和运算符。 有关详细信息,请参阅“[上下文](/actions/learn-github-actions/contexts)”和“[表达式](/actions/learn-github-actions/expressions)”。
Using expressions to create a `key` allows you to automatically create a new cache when dependencies change.
使用表达式创建 `key` 使你能够在依赖项更改时自动创建新缓存。
For example, you can create a `key` using an expression that calculates the hash of an npm `package-lock.json` file. So, when the dependencies that make up the `package-lock.json` file change, the cache key changes and a new cache is automatically created.
例如,可以使用可计算 npm `package-lock.json` 文件的哈希的表达式创建 `key`。 因此,当构成 `package-lock.json` 文件的依赖项更改时,缓存键会更改,并自动创建新缓存。
{% raw %}
```yaml
@@ -170,17 +174,17 @@ npm-${{ hashFiles('package-lock.json') }}
```
{% endraw %}
{% data variables.product.prodname_dotcom %} evaluates the expression `hash "package-lock.json"` to derive the final `key`.
{% data variables.product.prodname_dotcom %} 计算表达式 `hash "package-lock.json"` 以派生最终的 `key`
```yaml
npm-d5ea0750
```
### Using the output of the `cache` action
### 使用 `cache` 操作的输出
You can use the output of the `cache` action to do something based on whether a cache hit or miss occurred. When an exact match is found for a cache for the specified `key`, the `cache-hit` output is set to `true`.
可以使用 `cache` 操作的输出,以根据发生的是缓存命中还是缓存失误来执行某些操作。 找到指定 `key` 的缓存的精确匹配时,`cache-hit` 输出设置为 `true`
In the example workflow above, there is a step that lists the state of the Node modules if a cache miss occurred:
在上面的示例工作流中,有一个步骤会列出发生缓存失误时节点模块的状态:
```yaml
- if: {% raw %}${{ steps.cache-npm.outputs.cache-hit != 'true' }}{% endraw %}
@@ -189,15 +193,15 @@ In the example workflow above, there is a step that lists the state of the Node
run: npm list
```
## Matching a cache key
## 匹配缓存键
The `cache` action first searches for cache hits for `key` and the cache _version_ in the branch containing the workflow run. If there is no hit, it searches for `restore-keys` and the _version_. If there are still no hits in the current branch, the `cache` action retries same steps on the default branch. Please note that the scope restrictions apply during the search. For more information, see "[Restrictions for accessing a cache](#restrictions-for-accessing-a-cache)."
`cache` 操作首先在包含工作流运行的分支中搜索 `key` 和缓存版本的缓存命中。 如果没有命中,它会搜索 `restore-keys` 和版本。 如果当前分支中仍然没有命中,`cache` 操作会在默认分支上重试相同步骤。 请注意,范围限制在搜索期间适用。 有关详细信息,请参阅“[访问缓存的限制](#restrictions-for-accessing-a-cache)”。
Cache version is a way to stamp a cache with metadata of the `path` and the compression tool used while creating the cache. This ensures that the consuming workflow run uniquely matches a cache it can actually decompress and use. For more information, see [Cache Version](https://github.com/actions/cache#cache-version) in the Actions Cache documentation.
缓存版本是使用 `path` 元数据以及创建缓存时使用的压缩工具标记缓存的一种方法。 这可确保使用的工作流运行与它实际可以解压缩和使用的缓存唯一匹配。 有关详细信息,请参阅操作缓存文档中的[缓存版本](https://github.com/actions/cache#cache-version)
`restore-keys` allows you to specify a list of alternate restore keys to use when there is a cache miss on `key`. You can create multiple restore keys ordered from the most specific to least specific. The `cache` action searches the `restore-keys` in sequential order. When a key doesn't match directly, the action searches for keys prefixed with the restore key. If there are multiple partial matches for a restore key, the action returns the most recently created cache.
通过 `restore-keys`,你可以指定当 `key` 中发生缓存失误时要使用的备用还原键列表。 您可以创建从最具体到最不具体的多个恢复键。 `cache` 操作按顺序搜索 `restore-keys`。 当键不直接匹配时,操作将搜索以恢复键为前缀的键。 如果恢复键值有多个部分匹配项,操作将返回最近创建的缓存。
### Example using multiple restore keys
### 使用多个恢复键值的示例
{% raw %}
```yaml
@@ -208,7 +212,7 @@ restore-keys: |
```
{% endraw %}
The runner evaluates the expressions, which resolve to these `restore-keys`:
运行器将计算表达式,这些表达式解析为以下 `restore-keys`
{% raw %}
```yaml
@@ -219,13 +223,13 @@ restore-keys: |
```
{% endraw %}
The restore key `npm-feature-` matches any key that starts with the string `npm-feature-`. For example, both of the keys `npm-feature-fd3052de` and `npm-feature-a9b253ff` match the restore key. The cache with the most recent creation date would be used. The keys in this example are searched in the following order:
还原键 `npm-feature-` 与以字符串 `npm-feature-` 开头的任何键匹配。 例如,`npm-feature-fd3052de` `npm-feature-a9b253ff` 这两个键都与还原键匹配。 将使用创建日期最新的缓存。 此示例中的键值按以下顺序搜索:
1. **`npm-feature-d5ea0750`** matches a specific hash.
1. **`npm-feature-`** matches cache keys prefixed with `npm-feature-`.
1. **`npm-`** matches any keys prefixed with `npm-`.
1. `npm-feature-d5ea0750` 匹配特定哈希。
1. `npm-feature-` 匹配前缀为 `npm-feature-` 的缓存键。
1. `npm-` 匹配前缀为 `npm-` 的任何键。
#### Example of search priority
#### 搜索优先级示例
```yaml
key:
@@ -235,80 +239,76 @@ restore-keys: |
npm-
```
For example, if a pull request contains a `feature` branch and targets the default branch (`main`), the action searches for `key` and `restore-keys` in the following order:
例如,如果拉取请求包含 `feature` 分支,并以默认分支 (`main`) 为目标,则该操作将按以下顺序搜索 `key` `restore-keys`
1. Key `npm-feature-d5ea0750` in the `feature` branch
1. Key `npm-feature-` in the `feature` branch
1. Key `npm-` in the `feature` branch
1. Key `npm-feature-d5ea0750` in the `main` branch
1. Key `npm-feature-` in the `main` branch
1. Key `npm-` in the `main` branch
1. `feature` 分支中的键 `npm-feature-d5ea0750`
1. `feature` 分支中的键 `npm-feature-`
1. `feature` 分支中的键 `npm-`
1. `main` 分支中的键 `npm-feature-d5ea0750`
1. `main` 分支中的键 `npm-feature-`
1. `main` 分支中的键 `npm-`
## Usage limits and eviction policy
## 使用限制和收回政策
{% data variables.product.prodname_dotcom %} will remove any cache entries that have not been accessed in over 7 days. There is no limit on the number of caches you can store, but the total size of all caches in a repository is limited{% ifversion actions-cache-policy-apis %}. By default, the limit is 10 GB per repository, but this limit might be different depending on policies set by your enterprise owners or repository administrators.{% else %} to 10 GB.{% endif %}
{% data variables.product.prodname_dotcom %} 将删除 7 天内未被访问的任何缓存条目。 可以存储的缓存数没有限制,但存储库中所有缓存的总大小限制{% ifversion actions-cache-policy-apis %}。 默认情况下,每个存储库的限制为 10 GB但根据企业所有者或存储库管理员设置的策略此限制可能有所不同。{% else %} 10 GB{% endif %}
{% data reusables.actions.cache-eviction-process %} {% ifversion actions-cache-ui %}The cache eviction process may cause cache thrashing, where caches are created and deleted at a high frequency. To reduce this, you can review the caches for a repository and take corrective steps, such as removing caching from specific workflows. For more information, see "[Managing caches](#managing-caches)."{% endif %}{% ifversion actions-cache-admin-ui %} You can also increase the cache size limit for a repository. For more information, see "[Managing {% data variables.product.prodname_actions %} settings for a repository](/repositories/managing-your-repositorys-settings-and-features/enabling-features-for-your-repository/managing-github-actions-settings-for-a-repository#configuring-cache-storage-for-a-repository)."
{% data reusables.actions.cache-eviction-process %} {% ifversion actions-cache-ui %}缓存逐出过程可能会导致缓存抖动,即频繁地创建和删除缓存。 若要减少这种情况,可以查看存储库缓存并采取纠正措施,例如从特定工作流中删除缓存。 有关详细信息,请参阅“[管理缓存](#managing-caches)”。{% endif %}{% ifversion actions-cache-admin-ui %}还可以增加存储库的缓存大小限制。 有关详细信息,请参阅“[管理存储库的 {% data variables.product.prodname_actions %} 设置](/repositories/managing-your-repositorys-settings-and-features/enabling-features-for-your-repository/managing-github-actions-settings-for-a-repository#configuring-cache-storage-for-a-repository)”。
{% elsif actions-cache-policy-apis %}
For information on changing the policies for the repository cache size limit, see "[Enforcing policies for {% data variables.product.prodname_actions %} in your enterprise](/admin/policies/enforcing-policies-for-your-enterprise/enforcing-policies-for-github-actions-in-your-enterprise#enforcing-a-policy-for-cache-storage-in-your-enterprise)" and "[Managing {% data variables.product.prodname_actions %} settings for a repository](/repositories/managing-your-repositorys-settings-and-features/enabling-features-for-your-repository/managing-github-actions-settings-for-a-repository#configuring-cache-storage-for-a-repository)."
有关更改存储库缓存大小限制的策略的信息,请参阅“[在企业中强制实施 {% data variables.product.prodname_actions %} 策略](/admin/policies/enforcing-policies-for-your-enterprise/enforcing-policies-for-github-actions-in-your-enterprise#enforcing-a-policy-for-cache-storage-in-your-enterprise)”和“[管理存储库的 {% data variables.product.prodname_actions %} 设置](/repositories/managing-your-repositorys-settings-and-features/enabling-features-for-your-repository/managing-github-actions-settings-for-a-repository#configuring-cache-storage-for-a-repository)”。
{% endif %}
{% ifversion actions-cache-management %}
## Managing caches
## 管理缓存
{% ifversion actions-cache-ui %}
To manage caches created from your workflows, you can:
若要管理从工作流创建的缓存,可以:
- View a list of all cache entries for a repository.
- Filter and sort the list of caches using specific metadata such as cache size, creation time, or last accessed time.
- Delete cache entries from a repository.
- Monitor aggregate cache usage for repositories and organizations.
- 查看存储库的所有缓存条目的列表。
- 使用特定元数据(如缓存大小、创建时间或上次访问时间)对缓存列表进行筛选和排序。
- 从存储库中删除缓存条目。
- 监视存储库和组织的聚合缓存使用情况。
There are multiple ways to manage caches for your repositories:
可通过多种方式管理存储库缓存:
- Using the {% data variables.product.prodname_dotcom %} web interface, as shown below.
- Using the REST API. For more information, see the "[{% data variables.product.prodname_actions %} Cache](/rest/actions/cache)" REST API documentation.
- Installing a {% data variables.product.prodname_cli %} extension to manage your caches from the command line. For more information, see the [gh-actions-cache](https://github.com/actions/gh-actions-cache) extension.
- 使用 {% data variables.product.prodname_dotcom %} Web 界面,如下所示。
- 使用 REST API。 有关详细信息,请参阅“[{% data variables.product.prodname_actions %} 缓存](/rest/actions/cache)REST API 文档。
- 安装 {% data variables.product.prodname_cli %} 扩展来从命令行管理缓存。 有关详细信息,请参阅 [gh-actions-cache](https://github.com/actions/gh-actions-cache) 扩展。
{% else %}
You can use the {% data variables.product.product_name %} REST API to manage your caches. {% ifversion actions-cache-list-delete-apis %}You can use the API to list and delete cache entries, and see your cache usage.{% elsif actions-cache-management %}At present, you can use the API to see your cache usage, with more functionality expected in future updates.{% endif %} For more information, see the "[{% data variables.product.prodname_actions %} Cache](/rest/actions/cache)" REST API documentation.
可以使用 {% data variables.product.product_name %} REST API 来管理缓存。 {% ifversion actions-cache-list-delete-apis %}可以使用 API 列出和删除缓存条目,并查看缓存使用情况。{% elsif actions-cache-management %}目前,可以使用 API 查看缓存使用情况,将来的更新中预期会有更多功能。{% endif %}有关详细信息,请参阅“[{% data variables.product.prodname_actions %} 缓存](/rest/actions/cache)REST API 文档。
You can also install a {% data variables.product.prodname_cli %} extension to manage your caches from the command line. For more information about the extension, see [the extension documentation](https://github.com/actions/gh-actions-cache#readme). For more information about {% data variables.product.prodname_cli %} extensions, see "[Using GitHub CLI extensions](/github-cli/github-cli/using-github-cli-extensions)."
你还可以安装 {% data variables.product.prodname_cli %} 扩展来从命令行管理缓存。 有关扩展的详细信息,请参阅[扩展文档](https://github.com/actions/gh-actions-cache#readme)。 有关 {% data variables.product.prodname_cli %} 扩展的详细信息,请参阅“[使用 GitHub CLI 扩展](/github-cli/github-cli/using-github-cli-extensions)”。
{% endif %}
{% ifversion actions-cache-ui %}
### Viewing cache entries
### 查看缓存条目
You can use the web interface to view a list of cache entries for a repository. In the cache list, you can see how much disk space each cache is using, when the cache was created, and when the cache was last used.
可以使用 Web 界面查看存储库的缓存条目列表。 在缓存列表中,可以看到每个缓存占用的磁盘空间量、创建缓存的时间以及上次使用缓存的时间。
{% data reusables.repositories.navigate-to-repo %}
{% data reusables.repositories.actions-tab %}
{% data reusables.repositories.actions-cache-list %}
1. Review the list of cache entries for the repository.
{% data reusables.repositories.navigate-to-repo %} {% data reusables.repositories.actions-tab %} {% data reusables.repositories.actions-cache-list %}
1. 查看存储库的缓存条目列表。
* To search for cache entries used for a specific branch, click the **Branch** dropdown menu and select a branch. The cache list will display all of the caches used for the selected branch.
* To search for cache entries with a specific cache key, use the syntax `key: key-name` in the **Filter caches** field. The cache list will display caches from all branches where the key was used.
* 若要搜索用于特定分支的缓存条目,请单击“分支”下拉菜单并选择一个分支。 缓存列表将显示用于所选分支的所有缓存。
* 若要搜索具有特定缓存键的缓存条目,请使用“筛选缓存”字段中的语法 `key: key-name`。 缓存列表将显示使用键的所有分支中的缓存。
![Screenshot of the list of cache entries](/assets/images/help/repository/actions-cache-entry-list.png)
![缓存条目列表的屏幕截图](/assets/images/help/repository/actions-cache-entry-list.png)
### Deleting cache entries
### 删除缓存条目
Users with `write` access to a repository can use the {% data variables.product.prodname_dotcom %} web interface to delete cache entries.
对存储库具有 `write` 权限的用户可以使用 {% data variables.product.prodname_dotcom %} Web 界面删除缓存条目。
{% data reusables.repositories.navigate-to-repo %}
{% data reusables.repositories.actions-tab %}
{% data reusables.repositories.actions-cache-list %}
1. To the right of the cache entry you want to delete, click {% octicon "trash" aria-label="The trash icon" %}.
{% data reusables.repositories.navigate-to-repo %} {% data reusables.repositories.actions-tab %} {% data reusables.repositories.actions-cache-list %}
1. 在要删除的缓存条目的右侧,单击 {% octicon "trash" aria-label="The trash icon" %}
![Screenshot of the list of cache entries](/assets/images/help/repository/actions-cache-delete.png)
![缓存条目列表的屏幕截图](/assets/images/help/repository/actions-cache-delete.png)
{% endif %}

View File

@@ -33,18 +33,18 @@ children:
- /troubleshooting-tls-errors
- /configuring-time-synchronization
- /command-line-utilities
- /restricting-network-traffic-to-your-enterprise
- /restricting-network-traffic-to-your-enterprise-with-an-ip-allow-list
- /configuring-github-pages-for-your-enterprise
- /configuring-host-keys-for-your-instance
- /configuring-the-referrer-policy-for-your-enterprise
- /configuring-custom-footers
- /configuring-web-commit-signing
shortTitle: Configure your enterprise
ms.openlocfilehash: 3cc7deccfdf71a0e339fca8055f0cd4b5027a32c
ms.sourcegitcommit: fb047f9450b41b24afc43d9512a5db2a2b750a2a
ms.openlocfilehash: 4f19ba9cd3207c34b7eb679fb62481e04185ad2c
ms.sourcegitcommit: c562c85cc75ffe1eb4e9595d8adc09ec71697ab1
ms.translationtype: HT
ms.contentlocale: zh-CN
ms.lasthandoff: 09/11/2022
ms.locfileid: '147409229'
ms.lasthandoff: 11/22/2022
ms.locfileid: '148180110'
---

View File

@@ -1,6 +1,6 @@
---
title: Initializing GitHub AE
intro: 'To get your enterprise ready to use, you can complete the initial configuration of {% data variables.product.product_name %}.'
title: 初始化 GitHub AE
intro: '要让您的企业准备好使用,您可以完成 {% data variables.product.product_name %} 的初始配置。'
versions:
ghae: '*'
type: how_to
@@ -9,122 +9,127 @@ topics:
redirect_from:
- /admin/configuration/initializing-github-ae
- /enterprise-server@latest/admin/configuration/configuring-your-enterprise/initializing-github-ae
ms.openlocfilehash: a3c32a770bbf58be3589824302fe3a32be0e239a
ms.sourcegitcommit: ced661bdffebd0f96f6f76db109fbe31983448ba
ms.translationtype: HT
ms.contentlocale: zh-CN
ms.lasthandoff: 11/16/2022
ms.locfileid: '148167050'
---
## About initialization
## 关于初始化
Before you can initialize your enterprise, you must purchase {% data variables.product.product_name %}. For more information, contact {% data variables.contact.contact_enterprise_sales %}.
在初始化企业之前,必须购买 {% data variables.product.product_name %}。 更多信息请联系 {% data variables.contact.contact_enterprise_sales %}
{% data reusables.github-ae.initialize-enterprise %} Make sure the information you provide matches the intended enterprise owner's information in the IdP. For more information about enterprise owners, see "[Roles in an enterprise](/admin/user-management/managing-users-in-your-enterprise/roles-in-an-enterprise#enterprise-owner)."
{% data reusables.github-ae.initialize-enterprise %} 确保您提供的信息与 IdP 中的预期企业所有者信息相匹配。 有关企业所有者的详细信息,请参阅“[企业中的角色](/admin/user-management/managing-users-in-your-enterprise/roles-in-an-enterprise#enterprise-owner)”。
{% note %}
**Notes**:
**注释**
- If the initial password for {% data variables.product.prodname_ghe_managed %} expires before you finish initialization, you can request a password reset at any time from your invitation email.
- 如果 {% data variables.product.prodname_ghe_managed %} 的初始密码在您完成初始化之前过期,您可以随时从邀请电子邮件请求重置密码。
- Store the initial username and password for {% data variables.product.prodname_ghe_managed %} securely in a password manager. {% data reusables.saml.contact-support-if-your-idp-is-unavailable %}
- {% data variables.product.prodname_ghe_managed %} 的初始用户名和密码安全地存储在密码管理器中。 {% data reusables.saml.contact-support-if-your-idp-is-unavailable %}
{% endnote %}
During initialization, the enterprise owner will name your enterprise, configure SAML SSO, create policies for all organizations in your enterprise, and configure a support contact for your users.
在初始化期间,企业所有者将命名企业、配置 SAML SSO、为企业中的所有组织创建策略以及为用户配置支持联系人。
## Prerequisites
## 先决条件
To begin initialization, you will receive an invitation email from {% data variables.product.company_short %}. Before you configure {% data variables.product.prodname_ghe_managed %}, review the following prerequisites.
要开始初始化,您将收到来自 {% data variables.product.company_short %} 的邀请电子邮件。 在配置 {% data variables.product.prodname_ghe_managed %} 之前,要查看以下先决条件。
To initialize {% data variables.location.product_location %}, you must have a SAML identity provider (IdP). {% data reusables.saml.ae-uses-saml-sso %} To connect your IdP to your enterprise during initialization, you should have your IdP's Entity ID (SSO) URL, Issuer ID URL, and public signing certificate (Base64-encoded). For more information, see "[About identity and access management for your enterprise](/admin/authentication/about-identity-and-access-management-for-your-enterprise)."
要初始化 {% data variables.location.product_location %},必须具有 SAML 标识提供者 (Idp)。 {% data reusables.saml.ae-uses-saml-sso %} 在初始化过程中将您的 IdP 连接到企业,您应该具有您的 IdP 实体 ID (SSO) URL、发行者 ID URL 和公共签名证书Base64 编码)。 有关详细信息,请参阅“[关于企业标识和访问管理](/admin/authentication/about-identity-and-access-management-for-your-enterprise)”。
{% note %}
**Note**: {% data reusables.saml.create-a-machine-user %}
**注意**{% data reusables.saml.create-a-machine-user %}
{% endnote %}
## Signing in and naming your enterprise
## 登录并命名企业
1. Follow the instructions in your welcome email to reach your enterprise.
2. Type your credentials under "Change password", then click **Change password**.
3. Under "What would you like your enterprise account to be named?", type the enterprise's name, then click **Save and continue**.
!["Save and continue" button for naming an enterprise](/assets/images/enterprise/configuration/ae-enterprise-configuration.png)
1. 按照欢迎电子邮件中的说明联系您的企业。
2. 在“更改密码”下键入你的凭据,然后单击“更改密码”。
3. 在“你希望将企业帐户命名为什么?”下,键入企业的名称,然后单击“保存并继续”。
![“保存并继续”按钮,用于命名企业](/assets/images/enterprise/configuration/ae-enterprise-configuration.png)
## Connecting your IdP to your enterprise
## 将 IdP 连接到企业
To configure authentication for {% data variables.product.product_name %}, you must provide {% data variables.product.product_name %} with the details for your SAML IdP. {% data variables.product.company_short %} recommends using Azure AD as your IdP. For more information, see "[Configuring authentication and provisioning with your identity provider](/admin/authentication/configuring-authentication-and-provisioning-with-your-identity-provider)."
要配置 {% data variables.product.product_name %} 的身份验证,您必须提供包含 SAML IdP 详细信息的 {% data variables.product.product_name %} {% data variables.product.company_short %} 建议使用 Azure AD 作为您的 IdP。 有关详细信息,请参阅“[使用标识提供者配置身份验证和预配](/admin/authentication/configuring-authentication-and-provisioning-with-your-identity-provider)”。
1. To the right of "Set up your identity provider", click **Configure**.
!["Configure" button for IdP configuration](/assets/images/enterprise/configuration/ae-idp-configure.png)
1. Under "Sign on URL", copy and paste the URL for your SAML IdP.
![Text field for SAML IdP's sign-on URL](/assets/images/enterprise/configuration/ae-idp-sign-on-url.png)
1. Under "Issuer", copy and paste the issuer URL for your SAML IdP.
![Text field for SAML IdP's issuer URL](/assets/images/enterprise/configuration/ae-idp-issuer-url.png)
1. Under "Public certificate", copy and paste the public certificate for your SAML IdP.
![Text field for SAML IdP's public certificate](/assets/images/enterprise/configuration/ae-idp-public-certificate.png)
1. Click **Test SAML configuration** to ensure that the information you've entered is correct.
!["Test SAML configuration" button](/assets/images/enterprise/configuration/ae-test-saml-configuration.png)
1. Click **Save**.
!["Save" button for IdP configuration](/assets/images/enterprise/configuration/ae-save.png)
1. 在“设置标识提供者”右侧,单击“配置”。
![IdP 配置的“配置”按钮](/assets/images/enterprise/configuration/ae-idp-configure.png)
1. 在“Sign on URL(登录 URL”下复制并粘贴 SAML IdP 的 URL。
![SAML IdP 登录 URL 的文本字段](/assets/images/enterprise/configuration/ae-idp-sign-on-url.png)
1. 在“Issuer发行机构”下复制并粘贴 SAML IdP 的发行机构 URL。
![SAML IdP 的发行机构 URL 的文本字段](/assets/images/enterprise/configuration/ae-idp-issuer-url.png)
1. 在“Public certificate(公共证书)”下,复制并粘贴 SAML IdP 的公共证书。
![SAML IdP 公共证书的文本字段](/assets/images/enterprise/configuration/ae-idp-public-certificate.png)
1. 单击“测试 SAML 配置”,确保你输入的信息是正确的。
![“测试 SAML 配置”按钮](/assets/images/enterprise/configuration/ae-test-saml-configuration.png)
1. 单击“ **保存**”。
![用于 IdP 配置的“保存”按钮](/assets/images/enterprise/configuration/ae-save.png)
1. {% data reusables.saml.assert-the-administrator-attribute %}
## Setting your enterprise policies
## 设置企业策略
Configuring policies will set limitations for repository and organization management for your enterprise. These can be reconfigured after the initialization process.
配置策略将为企业的仓库和组织管理设置限制。 这些可以在初始化过程后重新配置。
1. To the right of "Set your enterprise policies", click **Configure**.
!["Configure" button for policies configuration](/assets/images/enterprise/configuration/ae-policies-configure.png)
2. Under "Default Repository Permissions", use the drop-down menu and click a default permissions level for repositories in your enterprise. If a person has multiple avenues of access to an organization, either individually, through a team, or as an organization member, the highest permission level overrides any lower permission levels. Optionally, to allow organizations within your enterprise to set their default repository permissions, click **No policy**
![Drop-down menu for default repository permissions options](/assets/images/enterprise/configuration/ae-repository-permissions-menu.png)
3. Under "Repository creation", choose whether you want to allow members to create repositories. Optionally, to allow organizations within your enterprise to set permissions, click **No policy**.
!["Members can create repositories" button for enterprise policies configuration](/assets/images/enterprise/configuration/ae-repository-creation-permissions.png)
4. Under "Repository forking", choose whether to allow forking of private and internal repositories. Optionally, to allow organizations within your enterprise to set permissions, click **No policy**
![Drop-down menu for repository forking permissions options](/assets/images/enterprise/configuration/ae-repository-forking-menu.png)
5. Under "Repository invitations", choose whether members or organization owners can invite collaborators to repositories. Optionally, to allow organizations within your enterprise to set permissions, click **No policy**
![Drop-down menu for repository invitation permissions options](/assets/images/enterprise/configuration/ae-repository-invitations-menu.png)
6. Under "Default repository visibility", use the drop-down menu and click the default visibility setting for new repositories.
![Drop-down menu for default repository visibility options](/assets/images/enterprise/configuration/ae-repository-visibility-menu.png)
7. Under "Users can create organizations", use the drop-down menu to enable or disable organization creation access for members of the enterprise.
![Drop-down menu for organization creation permissions options](/assets/images/enterprise/configuration/ae-organization-creation-permissions-menu.png)
8. Under "Force pushes", use the drop-down menu and choose whether to allow or block force pushes.
![Drop-down menu for force pushes configuration options](/assets/images/enterprise/configuration/ae-force-pushes-configuration-menu.png)
9. Under "Git SSH access", use the drop-down menu and choose whether to enable Git SSH access for all repositories in the enterprise.
![Drop-down menu for Git SSH access options](/assets/images/enterprise/configuration/ae-git-ssh-access-menu.png)
10. Click **Save**
!["Save" button for enterprise policies configuration](/assets/images/enterprise/configuration/ae-save.png)
11. Optionally, to reset all selections, click "Reset to default policies".
![Link to reset all default policies](/assets/images/enterprise/configuration/ae-reset-default-options.png)
1. 在“设置企业策略”右侧,单击“配置”。
![用于策略配置的“配置”按钮](/assets/images/enterprise/configuration/ae-policies-configure.png)
2. 在“Default Repository Permissions(默认仓库权限)”下,使用下拉菜单,并单击企业中仓库的默认权限级别。 如果某人可通过多种途径访问组织(个人访问、通过团队访问或作为组织成员访问),则最高的项目板权限级别将覆盖任何较低的权限级别。 (可选)若要允许企业内的组织设置其默认仓库权限,请单击“无策略”
![默认仓库权限选项的下拉菜单](/assets/images/enterprise/configuration/ae-repository-permissions-menu.png)
3. 在“Repository creation(仓库创建)”下,选择是否允许会员创建仓库. (可选)若要允许企业内的组织设置权限,请单击“无策略”。
![用于企业策略配置的“成员可创建存储库”按钮](/assets/images/enterprise/configuration/ae-repository-creation-permissions.png)
4. 在“Repository forking(仓库复刻)”下,选择是否允许私有和内部仓库复刻。 (可选)若要允许企业内的组织设置权限,请单击“无策略”
![存储库分支创建权限选项的下拉菜单](/assets/images/enterprise/configuration/ae-repository-forking-menu.png)
5. 在“Repository invitations(仓库邀请)”下,选择成员或组织所有者是否可以邀请合作者进入仓库。 (可选)若要允许企业内的组织设置权限,请单击“无策略”
![存储库邀请权限选项的下拉菜单](/assets/images/enterprise/configuration/ae-repository-invitations-menu.png)
6. 在“Default repository visibility(默认仓库可见性)”下,使用下拉菜单并单击新仓库的默认可见性设置。
![默认存储库可见性选项的下拉菜单](/assets/images/enterprise/configuration/ae-repository-visibility-menu.png)
7. 在“Users can create organizations(用户可以创建组织)”下,使用下拉菜单来启用或禁用企业成员创建组织。
![组织创建权限选项的下拉菜单](/assets/images/enterprise/configuration/ae-organization-creation-permissions-menu.png)
8. 在“Force pushes(强制推送)”下,使用下拉菜单选择是允许还是阻止强制推送。
![强制推送配置选项的下拉菜单](/assets/images/enterprise/configuration/ae-force-pushes-configuration-menu.png)
9. 在“Git SSH accessGit SSH 访问)”下,使用下拉菜单并选择是否为企业中所有仓库启用 Git SSH 访问。
![Git SSH 访问选项的下拉菜单](/assets/images/enterprise/configuration/ae-git-ssh-access-menu.png)
10. 单击“保存”
![用于企业策略配置的“保存”按钮](/assets/images/enterprise/configuration/ae-save.png)
11. (可选)要重置所有选项,请单击“Reset to default policies(重置为默认策略)”。
![重置所有默认策略的链接](/assets/images/enterprise/configuration/ae-reset-default-options.png)
## Setting your internal support contact
## 设置内部支持联系人
You can configure the method your users will use to contact your internal support team. This can be reconfigured after the initialization process.
您可以配置用户联系内部支持团队的方法。 这可以在初始化过程后重新配置。
1. To the right of "Internal support contact", click **Configure**.
!["Configure" button for internal support contact configuration](/assets/images/enterprise/configuration/ae-support-configure.png)
2. Under "Internal support contact", select the method for users of your enterprise to contact support, through a URL or an e-mail address. Then, type the support contact information.
![Text field for internal support contact URL](/assets/images/enterprise/configuration/ae-support-link-url.png)
3. Click **Save**.
!["Save" button for enterprise support contact configuration](/assets/images/enterprise/configuration/ae-save.png)
1. 在“内部支持联系人”右侧,单击“配置”。
![用于内部支持联系人配置的“配置”按钮](/assets/images/enterprise/configuration/ae-support-configure.png)
2. 在“Internal support contact(内部支持联系人)”下,选择您企业的用户通过网址或电子邮件地址联系支持的方法。 然后,键入支持联系信息。
![内部支持联系人 URL 的文本字段](/assets/images/enterprise/configuration/ae-support-link-url.png)
3. 单击“ **保存**”。
![用于企业支持联系人配置的“保存”按钮](/assets/images/enterprise/configuration/ae-save.png)
## Setting your email settings
## 设置电子邮件设置
Once this is initialized, you can reconfigure any settings after the initialization process. For more information, see "[Configuring email for notifications](/admin/configuration/configuring-email-for-notifications)."
一旦初始化,您便可在初始化过程后重新配置任何设置。 有关详细信息,请参阅“[配置邮件通知](/admin/configuration/configuring-email-for-notifications)”。
1. To the right of "Configure email settings", click **Configure**.
!["Configure" button for email settings configuration](/assets/images/enterprise/configuration/ae-email-configure.png)
2. Select **Enable email**. This will enable both outbound and inbound email, however, for inbound email to work you will also need to configure your DNS settings. For more information, see "[Configuring DNS and firewall
settings to allow incoming emails](/admin/configuration/configuring-email-for-notifications#configuring-dns-and-firewall-settings-to-allow-incoming-emails)."
!["Enable" checkbox for email settings configuration](/assets/images/enterprise/configuration/ae-enable-email-configure.png)
3. Complete your email server settings:
- In the **Server address** field, type the address of your SMTP server.
- In the **Port** field, type the port that your SMTP server uses to send email.
- In the **Domain** field, type the domain name that your SMTP server will send with a HELO response, if any.
- In the **Authentication** dropdown, choose the type of encryption used by your SMTP server.
- In the **No-reply email address** field, type the email address to use in the From and To fields for all notification emails.
1. 在“配置电子邮件设置”右侧,单击“配置”。
![用于电子邮件设置配置的“配置”按钮](/assets/images/enterprise/configuration/ae-email-configure.png)
2. 选择“启用电子邮件”。 这将启用出站和入站电子邮件,但是,为使入站电子邮件运行,您还需要配置 DNS 设置。 有关详细信息,请参阅“[配置 DNS 和防火墙设置,以允许传入电子邮件](/admin/configuration/configuring-email-for-notifications#configuring-dns-and-firewall-settings-to-allow-incoming-emails)”。
![用于电子邮件设置配置的“启用”复选框](/assets/images/enterprise/configuration/ae-enable-email-configure.png)
3. 完成电子邮件服务器设置:
- 在“服务器地址”字段中,输入 SMTP 服务器的地址。
- 在“端口”字段中,输入 SMTP 服务器用于发送电子邮件的端口。
- 在“域”字段中,输入 SMTP 服务器将随 HELO 响应(如有)发送的域名。
- 在“身份验证”下拉菜单中,选择 SMTP 服务器所使用的加密类型。
- 在“无回复电子邮件地址”字段中,输入要在所有通知电子邮件的“发件人”和“收件人”字段中使用的电子邮件地址。
4. If you want to discard all incoming emails that are addressed to the no-reply email address, select **Discard email addressed to the no-reply email address**.
!["Discard" checkbox for email settings configuration](/assets/images/enterprise/configuration/ae-discard-email.png)
5. Click **Test email settings**.
!["Test email settings" button for email settings configuration](/assets/images/enterprise/configuration/ae-test-email.png)
6. Under "Send test email to," type the email address where you want to send a test email, then click **Send test email**.
!["Send test email" button for email settings configuration](/assets/images/enterprise/configuration/ae-send-test-email.png)
7. Click **Save**.
!["Save" button for enterprise support contact configuration](/assets/images/enterprise/configuration/ae-save.png)
4. 如果想放弃发送到无回复电子邮件地址的所有传入电子邮件,请选中“放弃发送到无回复电子邮件地址的电子邮件”。
![用于电子邮件设置配置的“放弃”复选框](/assets/images/enterprise/configuration/ae-discard-email.png)
5. 单击“测试电子邮件设置”。
![用于邮件设置配置的“测试邮件设置”按钮](/assets/images/enterprise/configuration/ae-test-email.png)
6. 在“发送测试电子邮件到”下,请输入测试电子邮件要发送到的电子邮件地址,然后单击“发送测试电子邮件”。
![用于邮件设置配置的“发送测试电子邮件”按钮](/assets/images/enterprise/configuration/ae-send-test-email.png)
7. 单击“ **保存**”。
![用于企业支持联系人配置的“保存”按钮](/assets/images/enterprise/configuration/ae-save.png)

View File

@@ -1,92 +0,0 @@
---
title: Restricting network traffic to your enterprise
shortTitle: Restricting network traffic
intro: You can use an IP allow list to restrict access to your enterprise to connections from specified IP addresses.
versions:
ghae: '*'
type: how_to
topics:
- Access management
- Enterprise
- Fundamentals
- Networking
- Security
redirect_from:
- /admin/configuration/restricting-network-traffic-to-your-enterprise
---
## About IP allow lists
By default, authorized users can access your enterprise from any IP address. Enterprise owners can restrict access to assets owned by organizations in an enterprise account by configuring an allow list for specific IP addresses. {% data reusables.identity-and-permissions.ip-allow-lists-example-and-restrictions %}
{% data reusables.identity-and-permissions.ip-allow-lists-cidr-notation %}
{% data reusables.identity-and-permissions.ip-allow-lists-enable %} {% data reusables.identity-and-permissions.ip-allow-lists-enterprise %}
You can also configure allowed IP addresses for an individual organization. For more information, see "[Managing allowed IP addresses for your organization](/organizations/keeping-your-organization-secure/managing-allowed-ip-addresses-for-your-organization)."
By default, Azure network security group (NSG) rules leave all inbound traffic open on ports 22, 80, 443, and 25. Enterprise owners can contact {% data variables.contact.github_support %} to configure access restrictions for your instance.
For instance-level restrictions using Azure NSGs, contact {% data variables.contact.github_support %} with the IP addresses that should be allowed to access your enterprise instance. Specify address ranges using the standard CIDR (Classless Inter-Domain Routing) format. {% data variables.contact.github_support %} will configure the appropriate firewall rules for your enterprise to restrict network access over HTTP, SSH, HTTPS, and SMTP. For more information, see "[Receiving help from {% data variables.contact.github_support %}](/admin/enterprise-support/receiving-help-from-github-support)."
## Adding an allowed IP address
{% data reusables.identity-and-permissions.about-adding-ip-allow-list-entries %}
{% data reusables.enterprise-accounts.access-enterprise %}
{% data reusables.enterprise-accounts.settings-tab %}
{% data reusables.enterprise-accounts.security-tab %}
{% data reusables.identity-and-permissions.ip-allow-lists-add-ip %}
{% data reusables.identity-and-permissions.ip-allow-lists-add-description %}
{% data reusables.identity-and-permissions.ip-allow-lists-add-entry %}
{% data reusables.identity-and-permissions.check-ip-address %}
## Allowing access by {% data variables.product.prodname_github_apps %}
{% data reusables.identity-and-permissions.ip-allow-lists-githubapps-enterprise %}
## Enabling allowed IP addresses
{% data reusables.identity-and-permissions.about-enabling-allowed-ip-addresses %}
{% data reusables.enterprise-accounts.access-enterprise %}
{% data reusables.enterprise-accounts.settings-tab %}
{% data reusables.enterprise-accounts.security-tab %}
1. Under "IP allow list", select **Enable IP allow list**.
![Checkbox to allow IP addresses](/assets/images/help/security/enable-ip-allowlist-enterprise-checkbox.png)
4. Click **Save**.
## Editing an allowed IP address
{% data reusables.identity-and-permissions.about-editing-ip-allow-list-entries %}
{% data reusables.enterprise-accounts.access-enterprise %}
{% data reusables.enterprise-accounts.settings-tab %}
{% data reusables.enterprise-accounts.security-tab %}
{% data reusables.identity-and-permissions.ip-allow-lists-edit-entry %}
{% data reusables.identity-and-permissions.ip-allow-lists-edit-ip %}
{% data reusables.identity-and-permissions.ip-allow-lists-edit-description %}
8. Click **Update**.
{% data reusables.identity-and-permissions.check-ip-address %}
{% ifversion ip-allow-list-address-check %}
## Checking if an IP address is permitted
{% data reusables.identity-and-permissions.about-checking-ip-address %}
{% data reusables.enterprise-accounts.access-enterprise %}
{% data reusables.enterprise-accounts.settings-tab %}
{% data reusables.enterprise-accounts.security-tab %}
{% data reusables.identity-and-permissions.check-ip-address-step %}
{% endif %}
## Deleting an allowed IP address
{% data reusables.enterprise-accounts.access-enterprise %}
{% data reusables.enterprise-accounts.settings-tab %}
{% data reusables.enterprise-accounts.security-tab %}
{% data reusables.identity-and-permissions.ip-allow-lists-delete-entry %}
{% data reusables.identity-and-permissions.ip-allow-lists-confirm-deletion %}
## Using {% data variables.product.prodname_actions %} with an IP allow list
{% data reusables.actions.ip-allow-list-self-hosted-runners %}

View File

@@ -1,6 +1,6 @@
---
title: Initializing the cluster
intro: 'A {% data variables.product.prodname_ghe_server %} cluster must be set up with a license and initialized using the administrative shell (SSH).'
title: 初始化集群
intro: '{% data variables.product.prodname_ghe_server %} 集群必须使用许可进行设置,并使用管理 shell (SSH) 进行初始化。'
redirect_from:
- /enterprise/admin/clustering/initializing-the-cluster
- /enterprise/admin/enterprise-management/initializing-the-cluster
@@ -11,46 +11,50 @@ type: how_to
topics:
- Clustering
- Enterprise
ms.openlocfilehash: 91394d1d39301f77bc49a87012e04c3d5e9c3b60
ms.sourcegitcommit: ced661bdffebd0f96f6f76db109fbe31983448ba
ms.translationtype: HT
ms.contentlocale: zh-CN
ms.lasthandoff: 11/16/2022
ms.locfileid: '148167070'
---
{% data reusables.enterprise_clustering.clustering-requires-https %}
## Installing {% data variables.product.prodname_ghe_server %}
## 安装 {% data variables.product.prodname_ghe_server %}
1. On each cluster node, provision and install {% data variables.product.prodname_ghe_server %}. For more information, see "[Setting up a {% data variables.product.prodname_ghe_server %} instance](/enterprise/admin/guides/installation/setting-up-a-github-enterprise-server-instance)."
2. Using the administrative shell or DHCP, **only** configure the IP address of each node. Don't configure any other settings.
1. 在每个集群节点上,提供并安装 {% data variables.product.prodname_ghe_server %}。 有关详细信息,请参阅“[设置 {% data variables.product.prodname_ghe_server %} 实例](/enterprise/admin/guides/installation/setting-up-a-github-enterprise-server-instance)”。
2. 使用管理 shell DHCP,仅配置每个节点的 IP 地址。 不要配置任何其他设置。
## Configuring the first node
## 配置第一个节点
1. Connect to the node that will be designated as MySQL primary in `cluster.conf`. For more information, see "[About the cluster configuration file](/enterprise/admin/guides/clustering/initializing-the-cluster/#about-the-cluster-configuration-file)."
2. In your web browser, visit `https://<ip address>:8443/setup/`.
{% data reusables.enterprise_installation.upload-a-license-file %}
{% data reusables.enterprise_installation.save-settings-in-web-based-mgmt-console %}
{% data reusables.enterprise_installation.instance-will-restart-automatically %}
1. 连接到将在 `cluster.conf` 中指定为 MySQL 主要节点的节点。 有关详细信息,请参阅“[关于群集配置文件](/enterprise/admin/guides/clustering/initializing-the-cluster/#about-the-cluster-configuration-file)”。
2. 在 Web 浏览器中,访问 `https://<ip address>:8443/setup/`
{% data reusables.enterprise_installation.upload-a-license-file %} {% data reusables.enterprise_installation.save-settings-in-web-based-mgmt-console %} {% data reusables.enterprise_installation.instance-will-restart-automatically %}
## Initializing the cluster
## 初始化集群
To initialize the cluster, you need a cluster configuration file (`cluster.conf`). For more information, see "[About the cluster configuration file](/enterprise/admin/guides/clustering/initializing-the-cluster/#about-the-cluster-configuration-file)".
若要初始化群集,需要群集配置文件 (`cluster.conf`)。 有关详细信息,请参阅“[关于群集配置文件](/enterprise/admin/guides/clustering/initializing-the-cluster/#about-the-cluster-configuration-file)”。
1. From the first node that was configured, run `ghe-cluster-config-init`. This will initialize the cluster if there are nodes in the cluster configuration file that are not configured.
2. Run `ghe-cluster-config-apply`. This will validate the `cluster.conf` file, apply the configuration to each node file and bring up the configured services on each node.
1. 从配置的第一个节点开始,运行 `ghe-cluster-config-init`。 如果集群配置文件中存在未配置的节点,此操作会初始化集群。
2. 运行 `ghe-cluster-config-apply`。 这将验证 `cluster.conf` 文件、将配置应用于每个节点文件,并调出每个节点上已配置的服务。
To check the status of a running cluster use the `ghe-cluster-status` command.
若要检查正在运行的群集的状态,请使用 `ghe-cluster-status` 命令。
## About the cluster configuration file
## 关于集群配置文件
The cluster configuration file (`cluster.conf`) defines the nodes in the cluster, and what services they run.
For more information, see "[About cluster nodes](/enterprise/admin/guides/clustering/about-cluster-nodes)."
群集配置文件 (`cluster.conf`) 会定义群集中的节点及其运行的服务。
有关详细信息,请参阅“[关于群集节点](/enterprise/admin/guides/clustering/about-cluster-nodes)”。
This example `cluster.conf` defines a cluster with 11 nodes.
此示例 `cluster.conf` 定义具有 11 个节点的群集。
- Two nodes called `ghes-front-end-node-\*` run services responsible for responding to client requests.
- Three nodes called `ghes-database-node-\*` run services responsible for storage, retrieval, and replication of database data.
- Three nodes called `ghes-search-node-\*` run services responsible for search functionality.
- Three nodes called `ghes-storage-node-\*` run services responsible for storage, retrieval, and replication of data.
- 名为 `ghes-front-end-node-\*` 的两个节点运行负责响应客户端请求的服务。
- 名为 `ghes-database-node-\*` 的三个节点运行负责存储、检索和复制数据库数据的服务。
- 名为 `ghes-search-node-\*` 的三个节点运行负责搜索功能的服务。
- 名为 `ghes-storage-node-\*` 的三个节点运行负责存储、检索和复制数据的服务。
The names of the nodes can be any valid hostname you choose. The names are set as the hostname of each node, and will also be added to `/etc/hosts` on each node, so that the nodes are locally resolvable to each other.
节点的名称可以是您选择的任何有效主机名。 名称被设置为每个节点的主机名,并且还将添加到每个节点上的 `/etc/hosts` 中,以便节点可以在本地相互解析。
Specify the first cluster node you configured as the MySQL primary via `mysql-server` and `mysql-master`.
通过 `mysql-server` `mysql-master` 指定你配置为 MySQL 主要节点的第一个集群节点。
```ini
[cluster]
@@ -155,7 +159,7 @@ Specify the first cluster node you configured as the MySQL primary via `mysql-se
metrics-server = true
```
Create the file `/data/user/common/cluster.conf` on the configured first node. For example, using `vim`:
在配置的第一个节点上创建文件 `/data/user/common/cluster.conf`。 例如,使用 `vim`
```shell
ghe-data-node-1:~$ sudo vim /data/user/common/cluster.conf

View File

@@ -0,0 +1,49 @@
---
title: Enabling GitHub Actions with MinIO storage
intro: 'You can enable {% data variables.product.prodname_actions %} on {% data variables.product.prodname_ghe_server %} and use MinIO storage to store data generated by workflow runs.'
permissions: 'Site administrators can enable {% data variables.product.prodname_actions %} and configure enterprise settings.'
versions:
ghes: '*'
type: how_to
topics:
- Actions
- Enterprise
- Infrastructure
- Storage
redirect_from:
- /admin/github-actions/enabling-github-actions-with-minio-gateway-for-nas-storage
- /admin/github-actions/enabling-github-actions-for-github-enterprise-server/enabling-github-actions-with-minio-gateway-for-nas-storage
shortTitle: MinIO storage
---
## Prerequisites
Before enabling {% data variables.product.prodname_actions %}, make sure you have completed the following steps:
* Create your MinIO bucket for storing data generated by workflow runs. For more information about installing and configuring MinIO, see "[MinIO High Performance Object Storage](https://min.io/docs/minio/container/index.html)" and "[mc mb](https://min.io/docs/minio/linux/reference/minio-mc/mc-mb.html)" in the MinIO documentation.
To avoid resource contention on the appliance, we recommend that MinIO be hosted separately from {% data variables.location.product_location %}.
{% indented_data_reference reusables.actions.enterprise-s3-permission spaces=2 %}
{% data reusables.actions.enterprise-common-prereqs %}
## Enabling {% data variables.product.prodname_actions %} with MinIO storage
{% data reusables.enterprise_site_admin_settings.access-settings %}
{% data reusables.enterprise_site_admin_settings.management-console %}
{% data reusables.enterprise_management_console.actions %}
{% data reusables.actions.enterprise-enable-checkbox %}
1. Under "Artifact & Log Storage", select **Amazon S3**, and enter your storage bucket's details:
* **AWS Service URL**: The URL to your MinIO service. For example, `https://my-minio.example:9000`.
* **AWS S3 Bucket**: The name of your S3 bucket.
* **AWS S3 Access Key** and **AWS S3 Secret Key**: The `MINIO_ACCESS_KEY` and `MINIO_SECRET_KEY` used for your MinIO instance.
![Radio button for selecting Amazon S3 Storage and fields for MinIO configuration](/assets/images/enterprise/management-console/actions-minio-s3-storage.png)
1. Under "Artifact & Log Storage", select **Force path style**.
![Checkbox to Force path style](/assets/images/enterprise/management-console/actions-minio-force-path-style.png)
{% data reusables.enterprise_management_console.test-storage-button %}
{% data reusables.enterprise_management_console.save-settings %}
{% data reusables.actions.enterprise-postinstall-nextsteps %}

View File

@@ -1,7 +1,7 @@
---
title: Migrating your enterprise to GitHub Actions
title: 将企业迁移到 GitHub Actions
shortTitle: Migrate to Actions
intro: 'Learn how to plan a migration to {% data variables.product.prodname_actions %} for your enterprise from another provider.'
intro: '了解如何规划从其他提供商迁移到企业的 {% data variables.product.prodname_actions %}'
versions:
ghec: '*'
ghes: '*'
@@ -10,78 +10,83 @@ type: how_to
topics:
- Actions
- Enterprise
ms.openlocfilehash: 332d8af7f1087626509a9c72751882ea11f3072f
ms.sourcegitcommit: e8c012864f13f9146e53fcb0699e2928c949ffa8
ms.translationtype: HT
ms.contentlocale: zh-CN
ms.lasthandoff: 11/09/2022
ms.locfileid: '148159790'
---
## 关于企业迁移到 {% data variables.product.prodname_actions %}
## About enterprise migrations to {% data variables.product.prodname_actions %}
要将企业从现有系统迁移到 {% data variables.product.prodname_actions %},您可以规划迁移、完成迁移和停用现有系统。
To migrate your enterprise to {% data variables.product.prodname_actions %} from an existing system, you can plan the migration, complete the migration, and retire existing systems.
本指南介绍了迁移的具体注意事项。 有关向企业介绍 {% data variables.product.prodname_actions %} 的其他信息,请参阅“[向企业介绍 {% data variables.product.prodname_actions %}](/admin/github-actions/getting-started-with-github-actions-for-your-enterprise/introducing-github-actions-to-your-enterprise)”。
This guide addresses specific considerations for migrations. For additional information about introducing {% data variables.product.prodname_actions %} to your enterprise, see "[Introducing {% data variables.product.prodname_actions %} to your enterprise](/admin/github-actions/getting-started-with-github-actions-for-your-enterprise/introducing-github-actions-to-your-enterprise)."
## 规划迁移
## Planning your migration
在开始将企业迁移到 {% data variables.product.prodname_actions %} 之前,应确定将迁移哪些工作流程以及这些迁移将如何影响您的团队,然后规划如何以及何时完成迁移。
Before you begin migrating your enterprise to {% data variables.product.prodname_actions %}, you should identify which workflows will be migrated and how those migrations will affect your teams, then plan how and when you will complete the migrations.
### 利用迁移专家
### Leveraging migration specialists
{% data variables.product.company_short %} 可以帮助您进行迁移,并且您也可以购买 {% data variables.product.prodname_professional_services %}。 更多信息请联系您的专属代表或 {% data variables.contact.contact_enterprise_sales %}。
{% data variables.product.company_short %} can help with your migration, and you may also benefit from purchasing {% data variables.product.prodname_professional_services %}. For more information, contact your dedicated representative or {% data variables.contact.contact_enterprise_sales %}.
### 确定和清点迁移目标
### Identifying and inventorying migration targets
在迁移到 {% data variables.product.prodname_actions %} 之前,您需要全面了解企业在现有系统中使用的工作流程。
Before you can migrate to {% data variables.product.prodname_actions %}, you need to have a complete understanding of the workflows being used by your enterprise in your existing system.
首先,创建企业内现有构建和发布工作流的清单,收集有关哪些工作流程正被使用但需要迁移以及哪些工作流程留在后面迁移的信息。
First, create an inventory of the existing build and release workflows within your enterprise, gathering information about which workflows are being actively used and need to migrated and which can be left behind.
接下来,了解当前提供商与 {% data variables.product.prodname_actions %} 之间的区别。 这将帮助您评估迁移每个工作流程时遇到的任何困难,以及您的企业在哪些方面可能会遇到功能差异。 有关详细信息,请参阅“[迁移到 {% data variables.product.prodname_actions %}](/actions/migrating-to-github-actions)”。
Next, learn the differences between your current provider and {% data variables.product.prodname_actions %}. This will help you assess any difficulties in migrating each workflow, and where your enterprise might experience differences in features. For more information, see "[Migrating to {% data variables.product.prodname_actions %}](/actions/migrating-to-github-actions)."
使用此信息,您将能够确定哪些工作流程要迁移到 {% data variables.product.prodname_actions %}
With this information, you'll be able to determine which workflows you can and want to migrate to {% data variables.product.prodname_actions %}.
### 确定迁移对团队的影响
### Determine team impacts from migrations
当您更改企业中使用的工具时,会影响团队的工作方式。 您需要考虑将工作流从现有系统迁移到 {% data variables.product.prodname_actions %} 将如何影响开发人员的日常工作。
When you change the tools being used within your enterprise, you influence how your team works. You'll need to consider how moving a workflow from your existing systems to {% data variables.product.prodname_actions %} will affect your developers' day-to-day work.
确定将受迁移影响的任何流程、集成和第三方工具,并为需要进行的任何更新制定计划。
Identify any processes, integrations, and third-party tools that will be affected by your migration, and make a plan for any updates you'll need to make.
请考虑迁移可能会如何影响您的合规性问题。 例如,您现有的凭据扫描和安全分析工具是与 {% data variables.product.prodname_actions %} 一起使用,还是需要使用新工具?
Consider how the migration may affect your compliance concerns. For example, will your existing credential scanning and security analysis tools work with {% data variables.product.prodname_actions %}, or will you need to use new tools?
识别现有系统中的网关和检查,并验证是否可以使用 {% data variables.product.prodname_actions %} 实施它们。
Identify the gates and checks in your existing system and verify that you can implement them with {% data variables.product.prodname_actions %}.
### 识别和验证迁移工具
### Identifying and validating migration tools
自动迁移工具可以将企业的工作流程从现有系统的语法转换为 {% data variables.product.prodname_actions %} 所需的语法。 确定第三方工具或者联系您的专业代表或 {% data variables.contact.contact_enterprise_sales %},询问 {% data variables.product.company_short %} 可以提供的工具。 例如,可以使用 {% data variables.product.prodname_actions_importer %} 来规划 CI 管道、限定其范围以及将 CI 管道从各种受支持的服务迁移到 {% data variables.product.prodname_actions %}。 有关详细信息,请参阅“[使用 {% data variables.product.prodname_actions_importer %} 自动执行迁移](/actions/migrating-to-github-actions/automating-migration-with-github-actions-importer)”。
Automated migration tools can translate your enterprise's workflows from the existing system's syntax to the syntax required by {% data variables.product.prodname_actions %}. Identify third-party tooling or contact your dedicated representative or {% data variables.contact.contact_enterprise_sales %} to ask about tools that {% data variables.product.company_short %} can provide. For example, you can use the {% data variables.product.prodname_actions_importer %} to plan, scope, and migrate your CI pipelines to {% data variables.product.prodname_actions %} from various supported services. For more information, see "[Automating migration with {% data variables.product.prodname_actions_importer %}](/actions/migrating-to-github-actions/automating-migration-with-github-actions-importer)."
确定用于自动执行迁移的工具后,请通过在某些测试工作流程上运行该工具并验证结果是否符合预期来验证该工具。
After you've identified a tool to automate your migrations, validate the tool by running the tool on some test workflows and verifying that the results are as expected.
自动化工具应该能够迁移大部分工作流程,但您可能需要手动重写至少一小部分。 估计您需要完成的手动工作量。
Automated tooling should be able to migrate the majority of your workflows, but you'll likely need to manually rewrite at least a small percentage. Estimate the amount of manual work you'll need to complete.
### 确定迁移方法
### Deciding on a migration approach
确定最适合您的企业的迁移方法。 较小的团队可以使用“淘汰和替换”方法一次迁移所有工作流程。 对于大型企业,迭代方法可能更现实。 您可以选择让中央机构管理整个迁移过程,也可以要求各个团队通过迁移自己的工作流程进行自助服务。
Determine the migration approach that will work best for your enterprise. Smaller teams may be able to migrate all their workflows at once, with a "rip-and-replace" approach. For larger enterprises, an iterative approach may be more realistic. You can choose to have a central body manage the entire migration or you can ask individual teams to self serve by migrating their own workflows.
我们建议采用将主动管理与自助服务相结合的迭代方法。 从一小群早期采用者开始,他们可以充当您的内部拥护者。 确定一些足够全面的工作流程,以代表您的业务广度。 与早期采用者合作,将这些工作流程迁移到 {% data variables.product.prodname_actions %},根据需要进行迭代。 这将让其他团队相信他们的工作流程也可以迁移。
We recommend an iterative approach that combines active management with self service. Start with a small group of early adopters that can act as your internal champions. Identify a handful of workflows that are comprehensive enough to represent the breadth of your business. Work with your early adopters to migrate those workflows to {% data variables.product.prodname_actions %}, iterating as needed. This will give other teams confidence that their workflows can be migrated, too.
然后,使 {% data variables.product.prodname_actions %} 可供您的大型组织使用。 提供资源以帮助这些团队将自己的工作流程迁移到 {% data variables.product.prodname_actions %},并在现有系统将要停用时通知团队。
Then, make {% data variables.product.prodname_actions %} available to your larger organization. Provide resources to help these teams migrate their own workflows to {% data variables.product.prodname_actions %}, and inform the teams when the existing systems will be retired.
最后,通知仍在使用旧系统的任何团队,以便在特定时间范围内完成迁移。 您可以指出其他团队的成功案例,以向他们保证迁移是可能的,也是可取的。
Finally, inform any teams that are still using your old systems to complete their migrations within a specific timeframe. You can point to the successes of other teams to reassure them that migration is possible and desirable.
### 定义迁移计划
### Defining your migration schedule
确定迁移方法后,请制定一个计划,说明每个团队何时将其工作流程迁移到 {% data variables.product.prodname_actions %}。
After you decide on a migration approach, build a schedule that outlines when each of your teams will migrate their workflows to {% data variables.product.prodname_actions %}.
首先,确定您希望迁移完成的日期。 例如,您可以计划在与当前提供商的合同结束时完成迁移。
First, decide the date you'd like your migration to be complete. For example, you can plan to complete your migration by the time your contract with your current provider ends.
然后,与您的团队合作,创建一个符合最后期限又不会牺牲团队目标的时间表。 查看业务的节奏以及您要求迁移的每个团队的工作负载。 与每个团队协调,了解他们的交付时间表,并制定一个计划,允许团队在不影响其交付能力的时间迁移其工作流程。
Then, work with your teams to create a schedule that meets your deadline without sacrificing their team goals. Look at your business's cadence and the workload of each individual team you're asking to migrate. Coordinate with each team to understand their delivery schedules and create a plan that allows the team to migrate their workflows at a time that won't impact their ability to deliver.
## 迁移到 {% data variables.product.prodname_actions %}
## Migrating to {% data variables.product.prodname_actions %}
当您准备好开始迁移时,请使用上面计划的自动化工具和手动重写将现有工作流程转换为 {% data variables.product.prodname_actions %}
When you're ready to start your migration, translate your existing workflows to {% data variables.product.prodname_actions %} using the automated tooling and manual rewriting you planned for above.
您可能还希望维护现有系统中的旧构件,也许是通过编写脚本化进程来存档构件。
You may also want to maintain old build artifacts from your existing system, perhaps by writing a scripted process to archive the artifacts.
## 停用现有系统
## Retiring existing systems
迁移完成后,可以考虑停用现有系统。
After your migration is complete, you can think about retiring your existing system.
您可能希望在一段时间内并行运行这两个系统,同时验证 {% data variables.product.prodname_actions %} 配置是否稳定,而不会降低开发人员的体验。
You may want to run both systems side-by-side for some period of time, while you verify that your {% data variables.product.prodname_actions %} configuration is stable, with no degradation of experience for developers.
Eventually, decommission and shut off the old systems, and ensure that no one within your enterprise can turn the old systems back on.
最终,停用并关闭旧系统,并确保企业内没有人可以重新打开旧系统。

View File

@@ -63,7 +63,7 @@ includeGuides:
- /admin/configuration/configuring-github-connect/enabling-unified-search-for-your-enterprise
- /admin/configuration/initializing-github-ae
- /admin/configuration/network-ports
- /admin/configuration/restricting-network-traffic-to-your-enterprise
- /admin/configuration/restricting-network-traffic-to-your-enterprise-with-an-ip-allow-list
- /admin/configuration/site-admin-dashboard
- /admin/configuration/troubleshooting-ssl-errors
- /admin/configuration/using-github-enterprise-server-with-a-load-balancer
@@ -147,11 +147,11 @@ includeGuides:
- /admin/user-management/suspending-and-unsuspending-users
- /admin/overview/creating-an-enterprise-account
- /admin/user-management/managing-organizations-in-your-enterprise/restoring-a-deleted-organization
ms.openlocfilehash: 832e990d9b1c30895fce286f1357ef540a96af6f
ms.sourcegitcommit: 478f2931167988096ae6478a257f492ecaa11794
ms.openlocfilehash: 88a0fe93a3c2784d81d81f91a3b1c0311cac84c7
ms.sourcegitcommit: c562c85cc75ffe1eb4e9595d8adc09ec71697ab1
ms.translationtype: HT
ms.contentlocale: zh-CN
ms.lasthandoff: 09/09/2022
ms.locfileid: '147854122'
ms.lasthandoff: 11/22/2022
ms.locfileid: '148180112'
---

View File

@@ -1,7 +1,7 @@
---
title: '关于 {% data variables.product.prodname_emus %}'
title: About {% data variables.product.prodname_emus %}
shortTitle: About managed users
intro: '可以从标识提供者的 {% data variables.product.prodname_dotcom %} 上集中管理企业成员的标识和访问。'
intro: 'You can centrally manage identity and access for your enterprise members on {% data variables.product.prodname_dotcom %} from your identity provider.'
redirect_from:
- /early-access/github/articles/get-started-with-managed-users-for-your-enterprise
- /github/setting-up-and-managing-your-enterprise/managing-your-enterprise-users-with-your-identity-provider/about-enterprise-managed-users
@@ -17,55 +17,50 @@ topics:
- Enterprise
- SSO
allowTitleToDifferFromFilename: true
ms.openlocfilehash: 82a8b8c29ea38d57f0481146f2a857c2dcba8413
ms.sourcegitcommit: d82f268a6f0236d1f4d2bf3d049974ada0170402
ms.translationtype: HT
ms.contentlocale: zh-CN
ms.lasthandoff: 11/10/2022
ms.locfileid: '148160726'
---
## 关于 {% data variables.product.prodname_emus %}
使用 {% data variables.product.prodname_emus %},可以通过标识提供者 (IdP) 控制企业成员的用户帐户。 IdP 中分配给 {% data variables.product.prodname_emu_idp_application %} 应用程序的用户将会预配为 {% data variables.product.prodname_dotcom %} 上的新用户帐户,并添加到企业中。 可以通过 IdP 控制用户帐户的用户名、配置文件数据、团队成员身份和存储库访问权限。
## About {% data variables.product.prodname_emus %}
在 IdP 中,你可以为每个 {% data variables.enterprise.prodname_managed_user %} 提供用户、企业所有者或计费管理员的角色。 {% data variables.enterprise.prodname_managed_users_caps %} 可以拥有企业内的组织,并且可以将其他 {% data variables.enterprise.prodname_managed_users %} 添加到组织和其中的团队。 有关详细信息,请参阅“[企业中的角色](/github/setting-up-and-managing-your-enterprise/managing-users-in-your-enterprise/roles-in-an-enterprise)”和“[关于组织](/organizations/collaborating-with-groups-in-organizations/about-organizations)”。
With {% data variables.product.prodname_emus %}, you can control the user accounts of your enterprise members through your identity provider (IdP). Users assigned to the {% data variables.product.prodname_emu_idp_application %} application in your IdP are provisioned as new user accounts on {% data variables.product.prodname_dotcom %} and added to your enterprise. You control usernames, profile data, team membership, and repository access for the user accounts from your IdP.
In your IdP, you can give each {% data variables.enterprise.prodname_managed_user %} the role of user, enterprise owner, or billing manager. {% data variables.enterprise.prodname_managed_users_caps %} can own organizations within your enterprise and can add other {% data variables.enterprise.prodname_managed_users %} to the organizations and teams within. For more information, see "[Roles in an enterprise](/github/setting-up-and-managing-your-enterprise/managing-users-in-your-enterprise/roles-in-an-enterprise)" and "[About organizations](/organizations/collaborating-with-groups-in-organizations/about-organizations)."
{% ifversion oidc-for-emu %}
{% data reusables.enterprise-accounts.emu-cap-validates %} 有关详细信息,请参阅“[关于对 IdP 的条件访问策略的支持](/admin/identity-and-access-management/using-enterprise-managed-users-for-iam/about-support-for-your-idps-conditional-access-policy)”。
{% data reusables.enterprise-accounts.emu-cap-validates %} For more information, see "[About support for your IdP's Conditional Access Policy](/admin/identity-and-access-management/using-enterprise-managed-users-for-iam/about-support-for-your-idps-conditional-access-policy)."
{% endif %}
可以授予 {% data variables.enterprise.prodname_managed_users %} 访问权限以及参与企业内部存储库的能力,但 {% data variables.enterprise.prodname_managed_users %} 无法创建公共内容,也不能与其他用户、组织和企业协作处理 {% data variables.product.prodname_dotcom %} 的其余部分。 有关详细信息,请参阅“[{% data variables.enterprise.prodname_managed_users %} 的功能和限制](#abilities-and-restrictions-of-enterprise-managed-users)”。
You can grant {% data variables.enterprise.prodname_managed_users %} access to and the ability to contribute to repositories within your enterprise, but {% data variables.enterprise.prodname_managed_users %} cannot create public content or collaborate with other users, organizations, and enterprises on the rest of {% data variables.product.prodname_dotcom %}. For more information, see "[Abilities and restrictions of {% data variables.enterprise.prodname_managed_users %}](#abilities-and-restrictions-of-enterprise-managed-users)."
企业的 {% data variables.enterprise.prodname_managed_users %} 的用户名及其个人资料信息(例如显示名称和电子邮件地址)通过 IdP 设置,用户无法自行更改。 有关详细信息,请参阅“[用户名和个人资料信息](#usernames-and-profile-information)”。
The usernames of your enterprise's {% data variables.enterprise.prodname_managed_users %} and their profile information, such as display names and email addresses, are set by through your IdP and cannot be changed by the users themselves. For more information, see "[Usernames and profile information](#usernames-and-profile-information)."
企业所有者可以在 {% data variables.product.prodname_dotcom %} 上审核所有 {% data variables.enterprise.prodname_managed_users %} 的操作。 有关详细信息,请参阅“[企业的审核日志事件](/admin/monitoring-activity-in-your-enterprise/reviewing-audit-logs-for-your-enterprise/audit-log-events-for-your-enterprise#about-audit-log-events-for-your-enterprise)”。
Enterprise owners can audit all of the {% data variables.enterprise.prodname_managed_users %}' actions on {% data variables.product.prodname_dotcom %}. For more information, see "[Audit log events for your enterprise](/admin/monitoring-activity-in-your-enterprise/reviewing-audit-logs-for-your-enterprise/audit-log-events-for-your-enterprise#about-audit-log-events-for-your-enterprise)."
若要使用 {% data variables.product.prodname_emus %},需要启用了 {% data variables.product.prodname_emus %} 的单独企业帐户类型。 有关创建此帐户的详细信息,请参阅“[关于具有托管用户的企业](#about-enterprises-with-managed-users)”。
To use {% data variables.product.prodname_emus %}, you need a separate type of enterprise account with {% data variables.product.prodname_emus %} enabled. For more information about creating this account, see "[About enterprises with managed users](#about-enterprises-with-managed-users)."
{% note %}
注意:使用 {% data variables.product.prodname_ghe_cloud %} 进行标识和访问管理有多个选项,而 {% data variables.product.prodname_emus %} 并不是每个客户的最佳解决方案。 如需详细了解 {% data variables.product.prodname_emus %} 是否适合你的企业,请参阅“[关于企业身份验证](/admin/identity-and-access-management/managing-iam-for-your-enterprise/about-authentication-for-your-enterprise#identifying-the-best-authentication-method-for-your-enterprise)”。
**Note:** There are multiple options for identity and access management with {% data variables.product.prodname_ghe_cloud %}, and {% data variables.product.prodname_emus %} is not the best solution for every customer. For more information about whether {% data variables.product.prodname_emus %} is right for your enterprise, see "[About authentication for your enterprise](/admin/identity-and-access-management/managing-iam-for-your-enterprise/about-authentication-for-your-enterprise#identifying-the-best-authentication-method-for-your-enterprise)."
{% endnote %}
## 关于组织成员身份管理
## About organization membership management
可手动管理组织成员身份,也可使用 IdP 组自动更新成员身份。 要通过 IdP 管理组织成员身份,必须将成员添加到 IdP 组,并且 IdP 组必须连接到组织内的团队。 有关自动管理组织和团队成员身份的详细信息,请参阅“[使用标识提供者组管理团队成员身份](/admin/identity-and-access-management/managing-iam-with-enterprise-managed-users/managing-team-memberships-with-identity-provider-groups)”。
Organization memberships can be managed manually, or you can update memberships automatically using IdP groups. To manage organization memberships through your IdP, the members must be added to an IdP group, and the IdP group must be connected to a team within the organization. For more information about managing organization and team memberships automatically, see "[Managing team memberships with identity provider groups](/admin/identity-and-access-management/managing-iam-with-enterprise-managed-users/managing-team-memberships-with-identity-provider-groups)."
将成员添加到企业拥有的组织的方式(通过 IdP 组或手动)决定了必须如何从组织中删除他们。
The way a member is added to an organization owned by your enterprise (through IdP groups or manually) determines how they must be removed from an organization.
- 如果将成员手动添加到组织,则必须手动将其删除。 从 IdP 上的 {% data variables.product.prodname_emu_idp_application %} 应用程序中取消分配他们,将暂停用户,但不会将其从组织中删除。
- 如果用户由于被添加到映射到组织中的一个或多个团队的 IdP 组而成为该组织的成员,则从与组织关联的所有映射的 IdP 组中删除这些用户会将其从组织中删除。
- If a member was added to an organization manually, you must remove them manually. Unassigning them from the {% data variables.product.prodname_emu_idp_application %} application on your IdP will suspend the user but not remove them from the organization.
- If a user became a member of an organization because they were added to IdP groups mapped to one or more teams in the organization, removing them from _all_ of the mapped IdP groups associated with the organization will remove them from the organization.
要了解成员是如何添加到组织中的,可以按类型筛选成员列表。 有关详细信息,请参阅[查看企业中的人员](/admin/user-management/managing-users-in-your-enterprise/viewing-people-in-your-enterprise#filtering-by-member-type-in-an-enterprise-with-managed-users)
To discover how a member was added to an organization, you can filter the member list by type. For more information, see "[Viewing people in your enterprise](/admin/user-management/managing-users-in-your-enterprise/viewing-people-in-your-enterprise#filtering-by-member-type-in-an-enterprise-with-managed-users)."
## 标识提供者支持
## Identity provider support
{% data variables.product.prodname_emus %} 支持以下 IdP{% ifversion oidc-for-emu %} 和身份验证方法:
{% data variables.product.prodname_emus %} supports the following IdPs{% ifversion oidc-for-emu %} and authentication methods:
| | SAML | OIDCbeta 版本) |
| | SAML | OIDC |
|----------------------------------|-----------------------------------------------|-----------------------------------------------|
| Azure Active Directory | {% octicon "check" aria-label="Check icon" %} | {% octicon "check" aria-label="Check icon" %} |
| Okta | {% octicon "check" aria-label="Check icon" %} | |
@@ -75,36 +70,36 @@ ms.locfileid: '148160726'
{% endif %}
## {% data variables.enterprise.prodname_managed_users %} 的功能和限制
## Abilities and restrictions of {% data variables.enterprise.prodname_managed_users %}
{% data variables.enterprise.prodname_managed_users_caps %} 只能参与企业中的专用和内部存储库及其用户帐户拥有的专用存储库。 {% data variables.enterprise.prodname_managed_users_caps %} 对更广泛的 {% data variables.product.prodname_dotcom %} 社区具有只读访问权限。 这些针对用户和内容的可见性和访问限制适用于所有请求,包括 API 请求。
{% data variables.enterprise.prodname_managed_users_caps %} can only contribute to private and internal repositories within their enterprise and private repositories owned by their user account. {% data variables.enterprise.prodname_managed_users_caps %} have read-only access to the wider {% data variables.product.prodname_dotcom %} community. These visibility and access restrictions for users and content apply to all requests, including API requests.
* 不能邀请 {% data variables.enterprise.prodname_managed_users_caps %} 加入企业外部的组织或存储库,也不能邀请 {% data variables.enterprise.prodname_managed_users %} 加入其他企业。
* {% data variables.product.prodname_emus %} 不支持外部协作者。
* {% data variables.enterprise.prodname_managed_users_caps %} 无法在企业外部的存储库中创建问题或拉取请求、添加评论或添加反应,也不能加注星标、监视或创建分支。
* {% data variables.enterprise.prodname_managed_users_caps %} 可以查看 {% data variables.product.prodname_dotcom_the_website %} 上的所有公共存储库,但无法将代码推送到企业外部的存储库。
* {% data variables.enterprise.prodname_managed_users_caps %} 和创建的内容只对企业的其他成员可见。
* {% data variables.enterprise.prodname_managed_users_caps %} 无法关注企业外部的用户。
* {% data variables.enterprise.prodname_managed_users_caps %} 无法创建 Gist 或对 Gist 添加评论。
* {% data variables.enterprise.prodname_managed_users_caps %} 无法为 {% data variables.product.prodname_actions %} 创建入门工作流。
* {% data variables.enterprise.prodname_managed_users_caps %} 无法在其用户帐户上安装 {% data variables.product.prodname_github_apps %}
* 其他 {% data variables.product.prodname_dotcom %} 用户无法查看、提及或邀请 {% data variables.enterprise.prodname_managed_user %} 进行协作。
* 可以选择 {% data variables.enterprise.prodname_managed_users %} 是否能够创建其用户帐户拥有的存储库。 有关详细信息,请参阅“[在企业中实施存储库管理策略](/admin/policies/enforcing-policies-for-your-enterprise/enforcing-repository-management-policies-in-your-enterprise#enforcing-a-policy-for-repository-creation)”。
* 如果允许 {% data variables.enterprise.prodname_managed_users %} 创建其用户帐户拥有的存储库,则他们只能拥有专用存储库,并且只能邀请其他企业成员协作处理其用户拥有的存储库。
* {% data variables.enterprise.prodname_managed_users_caps %} cannot be invited to organizations or repositories outside of the enterprise, nor can the {% data variables.enterprise.prodname_managed_users %} be invited to other enterprises.
* Outside collaborators are not supported by {% data variables.product.prodname_emus %}.
* {% data variables.enterprise.prodname_managed_users_caps %} cannot create issues or pull requests in, comment or add reactions to, nor star, watch, or fork repositories outside of the enterprise.
* {% data variables.enterprise.prodname_managed_users_caps %} can view all public repositories on {% data variables.product.prodname_dotcom_the_website %}, but cannot push code to repositories outside of the enterprise.
* {% data variables.enterprise.prodname_managed_users_caps %} and the content they create is only visible to other members of the enterprise.
* {% data variables.enterprise.prodname_managed_users_caps %} cannot follow users outside of the enterprise.
* {% data variables.enterprise.prodname_managed_users_caps %} cannot create gists or comment on gists.
* {% data variables.enterprise.prodname_managed_users_caps %} cannot create starter workflows for {% data variables.product.prodname_actions %}.
* {% data variables.enterprise.prodname_managed_users_caps %} cannot install {% data variables.product.prodname_github_apps %} on their user accounts.
* Other {% data variables.product.prodname_dotcom %} users cannot see, mention, or invite a {% data variables.enterprise.prodname_managed_user %} to collaborate.
* You can choose whether {% data variables.enterprise.prodname_managed_users %} are able to create repositories owned by their user accounts. For more information, see "[Enforcing repository management policies in your enterprise](/admin/policies/enforcing-policies-for-your-enterprise/enforcing-repository-management-policies-in-your-enterprise#enforcing-a-policy-for-repository-creation)."
* If you allow {% data variables.enterprise.prodname_managed_users %} to create repositories owned by their user accounts, they can only own private repositories and can only invite other enterprise members to collaborate on their user-owned repositories.
* {% data reusables.enterprise-accounts.emu-forks %}
* 只能在 {% data variables.enterprise.prodname_emu_enterprise %} 拥有的组织中创建专用和内部存储库,具体取决于组织和企业存储库可见性设置。
* {% data variables.enterprise.prodname_managed_users_caps %} 在使用 {% data variables.product.prodname_pages %} 方面受到限制。 有关详细信息,请参阅“[关于 {% data variables.product.prodname_pages %}](/pages/getting-started-with-github-pages/about-github-pages#limitations-for-enterprise-managed-users)”。
* Only private and internal repositories can be created in organizations owned by an {% data variables.enterprise.prodname_emu_enterprise %}, depending on organization and enterprise repository visibility settings.
* {% data variables.enterprise.prodname_managed_users_caps %} are limited in their use of {% data variables.product.prodname_pages %}. For more information, see "[About {% data variables.product.prodname_pages %}](/pages/getting-started-with-github-pages/about-github-pages#limitations-for-enterprise-managed-users)."
* {% data reusables.copilot.emus-cannot-use-copilot %}
## {% data variables.product.prodname_emus %} 入门
## Getting started with {% data variables.product.prodname_emus %}
必须先执行一系列配置步骤,开发人员才能将 {% data variables.product.prodname_ghe_cloud %} {% data variables.product.prodname_emus %} 一起使用。
Before your developers can use {% data variables.product.prodname_ghe_cloud %} with {% data variables.product.prodname_emus %}, you must follow a series of configuration steps.
1. 若要使用 {% data variables.product.prodname_emus %},需要启用了 {% data variables.product.prodname_emus %} 的单独企业帐户类型。 若要试用 {% data variables.product.prodname_emus %} 或讨论从现有企业迁移的选项,请联系 [{% data variables.product.prodname_dotcom %} 的销售团队](https://enterprise.github.com/contact)
1. To use {% data variables.product.prodname_emus %}, you need a separate type of enterprise account with {% data variables.product.prodname_emus %} enabled. To try out {% data variables.product.prodname_emus %} or to discuss options for migrating from your existing enterprise, please contact [{% data variables.product.prodname_dotcom %}'s Sales team](https://enterprise.github.com/contact).
GitHub 销售团队的联系人将与你合作创建新的 {% data variables.enterprise.prodname_emu_enterprise %}。 你需要为将设置企业的用户提供电子邮件地址,以及一个短代码,该代码将用作企业成员用户名的后缀。 {% data reusables.enterprise-accounts.emu-shortcode %} 有关详细信息,请参阅“[用户名和个人资料信息](#usernames-and-profile-information)”。
Your contact on the GitHub Sales team will work with you to create your new {% data variables.enterprise.prodname_emu_enterprise %}. You'll need to provide the email address for the user who will set up your enterprise and a short code that will be used as the suffix for your enterprise members' usernames. {% data reusables.enterprise-accounts.emu-shortcode %} For more information, see "[Usernames and profile information](#usernames-and-profile-information)."
2. 创建企业后,你将收到来自 {% data variables.product.prodname_dotcom %} 的电子邮件,邀请你为企业的设置用户选择密码,该用户将是企业的第一个所有者。 设置密码时,请使用隐身或专用浏览窗口。 设置用户仅用于为企业配置单一登录和 SCIM 预配集成。 成功启用 SSO 后,设置用户将不再有权管理企业帐户。 设置用户的用户名是企业的短代码,后缀为 `_admin`
2. After we create your enterprise, you will receive an email from {% data variables.product.prodname_dotcom %} inviting you to choose a password for your enterprise's setup user, which will be the first owner in the enterprise. Use an incognito or private browsing window when setting the password. The setup user is only used to configure single sign-on and SCIM provisioning integration for the enterprise. It will no longer have access to administer the enterprise account once SSO is successfully enabled. The setup user's username is your enterprise's shortcode suffixed with `_admin`.
{% note %}
@@ -112,53 +107,54 @@ ms.locfileid: '148160726'
{% endnote %}
3. 你以设置用户身份登录后,我们建议你启用双因素身份验证。 有关详细信息,请参阅“[配置双因素身份验证](/authentication/securing-your-account-with-two-factor-authentication-2fa/configuring-two-factor-authentication)”。
3. After you log in as the setup user, we recommend enabling two-factor authentication. For more information, see "[Configuring two-factor authentication](/authentication/securing-your-account-with-two-factor-authentication-2fa/configuring-two-factor-authentication)."
1. 首先,请配置 {% ifversion oidc-for-emu %} 成员如何进行身份验证。 如果使用 Azure Active Directory 作为标识提供者,可以在 OpenID Connect (OIDC) 和安全断言标记语言 (SAML) 之间进行选择。 这两个选项都为成员提供无缝登录体验,但只有 OIDC 包括对条件访问策略 (CAP) 的支持。 如果使用 Okta 作为标识提供者,则可以使用 SAML 对成员进行身份验证。{% else %}SAML SSO 适用于企业。 有关详细信息,请参阅“[为 Enterprise 托管用户配置 SAML 单一登录](/admin/identity-and-access-management/managing-iam-with-enterprise-managed-users/configuring-saml-single-sign-on-for-enterprise-managed-users)”。{% endif %}
1. To get started, configure {% ifversion oidc-for-emu %}how your members will authenticate. If you are using Azure Active Directory as your identity provider, you can choose between OpenID Connect (OIDC) and Security Assertion Markup Language (SAML). We recommend OIDC, which includes support for Conditional Access Policies (CAP). If you require multiple enterprises with {% data variables.enterprise.prodname_managed_users %} provisioned from one tenant, you must use SAML for each enterprise after the first. If you are using Okta as your identity provider, you can use SAML to authenticate your members.{% else %}SAML SSO for your enterprise. For more information, see "[Configuring SAML single sign-on for Enterprise Managed Users](/admin/identity-and-access-management/managing-iam-with-enterprise-managed-users/configuring-saml-single-sign-on-for-enterprise-managed-users)."{% endif %}
{% ifversion oidc-for-emu %}
首先,请阅读所选身份验证方法的指南。
To get started, read the guide for your chosen authentication method.
- [为企业托管用户配置 OIDC](/admin/identity-and-access-management/using-enterprise-managed-users-for-iam/configuring-oidc-for-enterprise-managed-users)”。
- [为企业托管用户配置 SAML 单一登录](/admin/identity-and-access-management/managing-iam-with-enterprise-managed-users/configuring-saml-single-sign-on-for-enterprise-managed-users)”。
- "[Configuring OIDC for Enterprise Managed Users](/admin/identity-and-access-management/using-enterprise-managed-users-for-iam/configuring-oidc-for-enterprise-managed-users)."
- "[Configuring SAML single sign-on for Enterprise Managed Users](/admin/identity-and-access-management/managing-iam-with-enterprise-managed-users/configuring-saml-single-sign-on-for-enterprise-managed-users)."
{% endif %}
4. 配置 SSO 后,可以配置 SCIM 预配。 SCIM 是标识提供者在 {% data variables.product.prodname_dotcom_the_website %} 上创建 {% data variables.enterprise.prodname_managed_users %} 的方式。 有关配置 SCIM 预配的详细信息,请参阅“[为企业托管用户配置 SCIM 预配](/admin/identity-and-access-management/managing-iam-with-enterprise-managed-users/configuring-scim-provisioning-for-enterprise-managed-users)”。
4. Once you have configured SSO, you can configure SCIM provisioning. SCIM is how your identity provider will create {% data variables.enterprise.prodname_managed_users %} on {% data variables.product.prodname_dotcom_the_website %}. For more information on configuring SCIM provisioning, see "[Configuring SCIM provisioning for enterprise managed users](/admin/identity-and-access-management/managing-iam-with-enterprise-managed-users/configuring-scim-provisioning-for-enterprise-managed-users)."
5. 配置身份验证和预配后,可以通过将 IdP 组与团队同步来开始管理 {% data variables.enterprise.prodname_managed_users %} 的组织成员身份。 有关详细信息,请参阅[使用标识提供者组管理团队成员身份](/admin/identity-and-access-management/using-enterprise-managed-users-for-iam/managing-team-memberships-with-identity-provider-groups)
5. Once authentication and provisioning are configured, you can start managing organization membership for your {% data variables.enterprise.prodname_managed_users %} by synchronizing IdP groups with teams. For more information, see "[Managing team memberships with identity provider groups](/admin/identity-and-access-management/using-enterprise-managed-users-for-iam/managing-team-memberships-with-identity-provider-groups)."
如果企业成员必须使用一个工作站同时从 {% data variables.enterprise.prodname_managed_user %} 和个人帐户参与 {% data variables.location.product_location %} 上的存储库,则可以提供支持。 有关详细信息,请参阅“[支持在 {% data variables.product.prodname_dotcom_the_website %} 上具有多个用户帐户的开发人员](#supporting-developers-with-multiple-user-accounts-on-githubcom)”。
If members of your enterprise must use one workstation to contribute to repositories on {% data variables.location.product_location %} from both a {% data variables.enterprise.prodname_managed_user %} and a personal account, you can provide support. For more information, see "[Supporting developers with multiple user accounts on {% data variables.product.prodname_dotcom_the_website %}](#supporting-developers-with-multiple-user-accounts-on-githubcom)."
## 作为 {% data variables.enterprise.prodname_managed_user %} 进行身份验证
## Authenticating as a {% data variables.enterprise.prodname_managed_user %}
{% data variables.enterprise.prodname_managed_users_caps %} 必须通过其标识提供者进行身份验证。 若要进行身份验证,{% data variables.enterprise.prodname_managed_user %} 可以访问其 IdP 应用程序门户或使用 {% data variables.product.prodname_dotcom_the_website %} 上的登录页。
{% data variables.enterprise.prodname_managed_users_caps %} must authenticate through their identity provider. To authenticate, a {% data variables.enterprise.prodname_managed_user %} can visit their IdP application portal or use the login page on {% data variables.product.prodname_dotcom_the_website %}.
默认情况下,当未经身份验证的用户尝试访问使用 {% data variables.product.prodname_emus %} 的企业时,{% data variables.product.company_short %} 会显示 404 错误。 企业所有者可以选择性地启用自动重定向到单一登录 (SSO),而不会显示 404。 有关详细信息,请参阅“[为企业中的安全设置强制实施策略](/enterprise-cloud@latest/admin/policies/enforcing-policies-for-your-enterprise/enforcing-policies-for-security-settings-in-your-enterprise#managing-sso-for-unauthenticated-users)”。
By default, when an unauthenticated user attempts to access an enterprise that uses {% data variables.product.prodname_emus %}, {% data variables.product.company_short %} displays a 404 error. An enterprise owner can optionally enable automatic redirects to single sign-on (SSO) instead of the 404. For more information, see "[Enforcing policies for security settings in your enterprise](/enterprise-cloud@latest/admin/policies/enforcing-policies-for-your-enterprise/enforcing-policies-for-security-settings-in-your-enterprise#managing-sso-for-unauthenticated-users)."
{% data reusables.enterprise-accounts.about-recovery-codes %} 有关详细信息,请参阅“[管理企业的恢复代码](/admin/identity-and-access-management/managing-recovery-codes-for-your-enterprise)”。
{% data reusables.enterprise-accounts.about-recovery-codes %} For more information, see "[Managing recovery codes for your enterprise](/admin/identity-and-access-management/managing-recovery-codes-for-your-enterprise)."
### 通过 {% data variables.product.prodname_dotcom_the_website %} 作为 {% data variables.enterprise.prodname_managed_user %} 进行身份验证
### Authenticating as a {% data variables.enterprise.prodname_managed_user %} via {% data variables.product.prodname_dotcom_the_website %}
1. 导航到 [https://github.com/login](https://github.com/login)
1. 在“用户名或电子邮件地址”文本框中,输入用户名,包括下划线和短代码。
![显示登录表单的屏幕截图](/assets/images/help/enterprises/emu-login-username.png) 表单识别用户名后将更新。 无需在此表单中输入密码。
1. 若要继续访问标识提供者,请单击“使用标识提供者登录”。
![显示“使用标识提供者登录”按钮的屏幕截图](/assets/images/help/enterprises/emu-login-submit.png)
1. Navigate to [https://github.com/login](https://github.com/login).
1. In the "Username or email address" text box, enter your username including the underscore and short code.
![Screenshot showing login form](/assets/images/help/enterprises/emu-login-username.png)
When the form recognizes your username, the form will update. You do not need to enter your password on this form.
1. To continue to your identity provider, click **Sign in with your identity provider**.
![Screenshot showing "Sign in with your identity provider" button](/assets/images/help/enterprises/emu-login-submit.png)
## 用户名和个人资料信息
## Usernames and profile information
{% data variables.product.product_name %} 通过规范 IdP 提供的标识符自动为每个用户创建用户名。 有关详细信息,请参阅“[外部身份验证的用户名注意事项](/admin/identity-and-access-management/managing-iam-for-your-enterprise/username-considerations-for-external-authentication)”。
{% data variables.product.product_name %} automatically creates a username for each person by normalizing an identifier provided by your IdP. For more information, see "[Username considerations for external authentication](/admin/identity-and-access-management/managing-iam-for-your-enterprise/username-considerations-for-external-authentication)."
如果在规范化期间删除 IdP 提供的标识符的唯一部分,则预配用户时可能会发生冲突。 如果由于用户名冲突而无法预配用户,则应修改 IdP 提供的用户名。 有关详细信息,请参阅“[解决用户名问题](/admin/identity-and-access-management/managing-iam-for-your-enterprise/username-considerations-for-external-authentication#resolving-username-problems)”。
A conflict may occur when provisioning users if the unique parts of the identifier provided by your IdP are removed during normalization. If you're unable to provision a user due to a username conflict, you should modify the username provided by your IdP. For more information, see "[Resolving username problems](/admin/identity-and-access-management/managing-iam-for-your-enterprise/username-considerations-for-external-authentication#resolving-username-problems)."
{% data reusables.enterprise-accounts.emu-only-emails-within-the-enterprise-can-conflict %}
IdP 还提供了 {% data variables.enterprise.prodname_managed_user %} 的个人资料名称和电子邮件地址。 {% data variables.enterprise.prodname_managed_users_caps %} 无法更改 {% data variables.product.prodname_dotcom %} 上的个人资料名称或电子邮件地址,并且 IdP 仅可提供单个电子邮件地址。
The profile name and email address of a {% data variables.enterprise.prodname_managed_user %} is also provided by the IdP. {% data variables.enterprise.prodname_managed_users_caps %} cannot change their profile name or email address on {% data variables.product.prodname_dotcom %}, and the IdP can only provide a single email address.
## 支持在 {% data variables.location.product_location %} 上具有多个用户帐户的开发人员
## Supporting developers with multiple user accounts on {% data variables.location.product_location %}
团队中的人员可能需要在 {% data variables.location.product_location %} 上参与 {% data variables.enterprise.prodname_emu_enterprise %} 外部的资源。 例如,你可能希望为公司的开放源代码项目维护单独的企业。 由于 {% data variables.enterprise.prodname_managed_user %} 无法参与公共资源,因此用户需要为此工作维护单独的个人帐户。
People on your team may need to contribute to resources on {% data variables.location.product_location %} that are outside of your {% data variables.enterprise.prodname_emu_enterprise %}. For example, you may wish to maintain a separate enterprise for your company's open source projects. Because a {% data variables.enterprise.prodname_managed_user %} cannot contribute to public resources, users will need to maintain a separate, personal account for this work.
必须使用一个工作站在 {% data variables.location.product_location %} 上从两个用户帐户进行参与的人员可以配置 Git 以简化该过程。 有关详细信息,请参阅“[管理多个帐户](/account-and-profile/setting-up-and-managing-your-personal-account-on-github/managing-your-personal-account/managing-multiple-accounts)”。
People who must contribute from two user accounts on {% data variables.location.product_location %} using one workstation can configure Git to simplify the process. For more information, see "[Managing multiple accounts](/account-and-profile/setting-up-and-managing-your-personal-account-on-github/managing-your-personal-account/managing-multiple-accounts)."

View File

@@ -1,7 +1,7 @@
---
title: About support for your IdP's Conditional Access Policy
shortTitle: Conditional access policy
intro: 'When your enterprise uses OIDC SSO, {% data variables.product.prodname_dotcom %} will validate access to your enterprise and its resources using your IdP''s Conditional Access Policy (CAP).'
intro: 'When your enterprise uses OIDC SSO, {% data variables.product.prodname_dotcom %} can validate access to your enterprise and its resources using your IdP''s Conditional Access Policy (CAP).'
product: '{% data reusables.gated-features.emus %}'
versions:
feature: oidc-for-emu
@@ -12,22 +12,17 @@ topics:
- SSO
---
{% data reusables.enterprise-accounts.oidc-beta-notice %}
{% data reusables.enterprise-accounts.azure-emu-support-oidc %}
## About support for Conditional Access Policies
{% data reusables.enterprise-accounts.emu-cap-validates %}
CAP support is enabled automatically for any {% data variables.enterprise.prodname_emu_enterprise %} that enables OIDC SSO and cannot be disabled. {% data variables.product.prodname_dotcom %} enforces your IdP's IP conditions but not device compliance conditions.
{% data variables.product.product_name %} supports CAP for any {% data variables.enterprise.prodname_emu_enterprise %} where OIDC SSO is enabled. {% data variables.product.product_name %} enforces your IdP's IP conditions but cannot enforce your device compliance conditions. Enterprise owners can choose to use this IP allow list configuration instead of {% data variables.product.product_name %}'s IP allow list, and can do so once OIDC SSO is configured. For more information about IP allow lists, see "[Restricting network traffic with an IP allow list](/admin/configuration/configuring-your-enterprise/restricting-network-traffic-to-your-enterprise-with-an-ip-allow-list)" and "[Managing allowed IP addresses for your organization](/organizations/keeping-your-organization-secure/managing-security-settings-for-your-organization/managing-allowed-ip-addresses-for-your-organization)."
For more information about using OIDC with {% data variables.product.prodname_emus %}, see "[Configuring OIDC for Enterprise Managed Users](/admin/identity-and-access-management/using-enterprise-managed-users-for-iam/configuring-oidc-for-enterprise-managed-users)" and "[Migrating from SAML to OIDC](/admin/identity-and-access-management/using-enterprise-managed-users-for-iam/migrating-from-saml-to-oidc)."
{% note %}
**Note:** If you use Conditional Access (CA) network location policies in your Azure AD tenant, do not use the IP allow list feature on {% data variables.product.prodname_dotcom_the_website %}, with your enterprise account or with any of the organizations owned by the enterprise. Using both is unsupported and can result in the wrong policy applying. For more information about IP allow lists, see "[Enforcing security settings in your enterprise](/admin/policies/enforcing-policies-for-your-enterprise/enforcing-policies-for-security-settings-in-your-enterprise#managing-allowed-ip-addresses-for-organizations-in-your-enterprise)" and "[Managing allowed IP addresses for your organization](/organizations/keeping-your-organization-secure/managing-security-settings-for-your-organization/managing-allowed-ip-addresses-for-your-organization)."
{% endnote %}
## Considerations for integrations and automations
{% data variables.product.prodname_dotcom %} sends the originating IP address to your IdP for validation against your CAP. To make sure actions and apps are not blocked by your IdP's CAP, you will need to make changes to your configuration.
@@ -46,4 +41,4 @@ When {% data variables.product.prodname_github_apps %} and {% data variables.pro
You can contact the owners of the apps you want to use, ask for their IP ranges, and configure your IdP's CAP to allow access from those IP ranges. If you're unable to contact the owners, you can review your IdP sign-in logs to review the IP addresses seen in the requests, then allow-list those addresses.
You can also enable IP allow list configuration for installed {% data variables.product.prodname_github_apps %}. When enabled, all {% data variables.product.prodname_github_apps %} and {% data variables.product.prodname_oauth_apps %} will continue working regardless of the originating IP address. For more information, see "[Enforcing policies for security settings in your enterprise](/admin/policies/enforcing-policies-for-your-enterprise/enforcing-policies-for-security-settings-in-your-enterprise#allowing-access-by-github-apps)."
If you do not wish to allow all of the IP ranges for all of your enterprise's apps, you can also exempt installed {% data variables.product.prodname_github_apps %} and authorized {% data variables.product.prodname_oauth_apps %} from the IdP allow list. If you do so, these apps will continue working regardless of the originating IP address. For more information, see "[Enforcing policies for security settings in your enterprise](/admin/policies/enforcing-policies-for-your-enterprise/enforcing-policies-for-security-settings-in-your-enterprise#allowing-access-by-github-apps)."

View File

@@ -12,7 +12,7 @@ topics:
- SSO
---
{% data reusables.enterprise-accounts.oidc-beta-notice %}
{% data reusables.enterprise-accounts.azure-emu-support-oidc %}
## About OIDC for Enterprise Managed Users
@@ -22,13 +22,13 @@ With {% data variables.product.prodname_emus %}, your enterprise uses your ident
You can adjust the lifetime of a session, and how often a {% data variables.enterprise.prodname_managed_user %} needs to reauthenticate with your IdP, by changing the lifetime policy property of the ID tokens issued for {% data variables.product.prodname_dotcom %} from your IdP. The default lifetime is one hour. For more information, see "[Configurable token lifetimes in the Microsoft identity platform](https://docs.microsoft.com/en-us/azure/active-directory/develop/active-directory-configurable-token-lifetimes)" in the Azure AD documentation.
If you currently use SAML SSO for authentication and would prefer to use OIDC and benefit from CAP support, you can follow a migration path. For more information, see "[Migrating from SAML to OIDC](/admin/identity-and-access-management/using-enterprise-managed-users-for-iam/migrating-from-saml-to-oidc)."
{% data reusables.enterprise_user_management.SAML-to-OIDC-migration-for-EMU %}
{% data reusables.enterprise-accounts.oidc-gei-warning %}
## Identity provider support
Support for OIDC is in public beta and available for customers using Azure Active Directory (Azure AD).
Support for OIDC is available for customers using Azure Active Directory (Azure AD).
Each Azure AD tenant can support only one OIDC integration with {% data variables.product.prodname_emus %}. If you want to connect Azure AD to more than one enterprise on {% data variables.product.prodname_dotcom %}, use SAML instead. For more information, see "[Configuring SAML single sign-on for {% data variables.product.prodname_emus %}](/admin/identity-and-access-management/using-enterprise-managed-users-for-iam/configuring-saml-single-sign-on-for-enterprise-managed-users)."

View File

@@ -19,7 +19,7 @@ topics:
## About SAML single sign-on for {% data variables.product.prodname_emus %}
With {% data variables.product.prodname_emus %}, your enterprise uses SAML SSO to authenticate all members. Instead of signing in to {% data variables.product.prodname_dotcom %} with a {% data variables.product.prodname_dotcom %} username and password, members of your enterprise will sign in through your IdP.
With {% data variables.product.prodname_emus %}, your enterprise uses your corporate identity provider to authenticate all members. Instead of signing in to {% data variables.product.prodname_dotcom %} with a {% data variables.product.prodname_dotcom %} username and password, members of your enterprise will sign in through your IdP.
{% data variables.product.prodname_emus %} supports the following IdPs:
@@ -27,6 +27,9 @@ With {% data variables.product.prodname_emus %}, your enterprise uses SAML SSO t
After you configure SAML SSO, we recommend storing your recovery codes so you can recover access to your enterprise in the event that your identity provider is unavailable.
{% data reusables.enterprise_user_management.SAML-to-OIDC-migration-for-EMU %}
{% note %}
**Note:** When SAML SSO is enabled, the only setting you can update on {% data variables.product.prodname_dotcom %} for your existing SAML configuration is the SAML certificate. If you need to update the Sign on URL or Issuer, you must first disable SAML SSO and then reconfigure SAML SSO with the new settings.

View File

@@ -12,7 +12,7 @@ topics:
- SSO
---
{% data reusables.enterprise-accounts.oidc-beta-notice %}
{% data reusables.enterprise-accounts.azure-emu-support-oidc %}
## About migrating your {% data variables.enterprise.prodname_emu_enterprise %} from SAML to OIDC

View File

@@ -124,5 +124,7 @@ If you use Okta as your IdP, you can map your Okta groups to teams on {% data va
## Further reading
- [SAML Wiki](https://wiki.oasis-open.org/security) on the OASIS website
- [System for Cross-domain Identity Management: Protocol (RFC 7644)](https://tools.ietf.org/html/rfc7644) on the IETF website{% ifversion ghae %}
- [Restricting network traffic to your enterprise](/admin/configuration/restricting-network-traffic-to-your-enterprise){% endif %}
- [System for Cross-domain Identity Management: Protocol (RFC 7644)](https://tools.ietf.org/html/rfc7644) on the IETF website
{%- ifversion ghae %}
- "[Restricting network traffic to your enterprise with an IP allow list](/admin/configuration/configuring-your-enterprise/restricting-network-traffic-to-your-enterprise-with-an-ip-allow-list)"
{%- endif %}

View File

@@ -1,7 +1,7 @@
---
title: Configuring authentication and provisioning for your enterprise using Azure AD
title: 使用 Azure AD 为企业配置身份验证和预配
shortTitle: Configure with Azure AD
intro: 'You can use a tenant in Azure Active Directory (Azure AD) as an identity provider (IdP) to centrally manage authentication and user provisioning for {% data variables.location.product_location %}.'
intro: '可以使用 Azure Active Directory (Azure AD) 中的租户作为标识提供者 (IdP) 来集中管理{% data variables.location.product_location %}的身份验证和用户预配。'
permissions: 'Enterprise owners can configure authentication and provisioning for an enterprise on {% data variables.product.product_name %}.'
versions:
ghae: '*'
@@ -17,65 +17,69 @@ redirect_from:
- /admin/authentication/configuring-authentication-and-provisioning-for-your-enterprise-using-azure-ad
- /admin/authentication/configuring-authentication-and-provisioning-with-your-identity-provider/configuring-authentication-and-provisioning-for-your-enterprise-using-azure-ad
- /admin/identity-and-access-management/configuring-authentication-and-provisioning-with-your-identity-provider/configuring-authentication-and-provisioning-for-your-enterprise-using-azure-ad
ms.openlocfilehash: bfd93814b11066d6da2d87a2e1f0a8bd5461e93f
ms.sourcegitcommit: ced661bdffebd0f96f6f76db109fbe31983448ba
ms.translationtype: HT
ms.contentlocale: zh-CN
ms.lasthandoff: 11/16/2022
ms.locfileid: '148167058'
---
## 关于使用 Azure AD 进行身份验证和用户预配
## About authentication and user provisioning with Azure AD
Azure Active Directory (Azure AD) 是一项来自 Microsoft 的服务,它允许您集中管理用户帐户和 web 应用程序访问。 有关详细信息,请参阅 Microsoft Docs 中的[什么是 Azure Active Directory](https://docs.microsoft.com/azure/active-directory/fundamentals/active-directory-whatis)
Azure Active Directory (Azure AD) is a service from Microsoft that allows you to centrally manage user accounts and access to web applications. For more information, see [What is Azure Active Directory?](https://docs.microsoft.com/azure/active-directory/fundamentals/active-directory-whatis) in the Microsoft Docs.
To manage identity and access for {% data variables.product.product_name %}, you can use an Azure AD tenant as a SAML IdP for authentication. You can also configure Azure AD to automatically provision accounts and access membership with SCIM, which allows you to create {% data variables.product.product_name %} users and manage team and organization membership from your Azure AD tenant.
要管理身份以及对 {% data variables.product.product_name %} 的访问,您可以使用 Azure AD 租户作为 SAML IdP 进行身份验证。 也可以配置 Azure AD 以自动预配帐户并获取 SCIM 成员资格,这样你可以创建 {% data variables.product.product_name %} 用户,并从你的 Azure AD 租户管理团队和组织成员资格。
{% data reusables.scim.ghes-beta-note %}
After you enable SAML SSO and SCIM for {% data variables.product.product_name %} using Azure AD, you can accomplish the following from your Azure AD tenant.
使用 Azure AD 对 {% data variables.product.product_name %} 启用 SAML SSO 和 SCIM 后,你可以从 Azure AD 租户完成以下任务。
* Assign the {% data variables.product.product_name %} application on Azure AD to a user account to automatically create and grant access to a corresponding user account on {% data variables.product.product_name %}.
* Unassign the {% data variables.product.product_name %} application to a user account on Azure AD to deactivate the corresponding user account on {% data variables.product.product_name %}.
* Assign the {% data variables.product.product_name %} application to an IdP group on Azure AD to automatically create and grant access to user accounts on {% data variables.product.product_name %} for all members of the IdP group. In addition, the IdP group is available on {% data variables.product.product_name %} for connection to a team and its parent organization.
* Unassign the {% data variables.product.product_name %} application from an IdP group to deactivate the {% data variables.product.product_name %} user accounts of all IdP users who had access only through that IdP group and remove the users from the parent organization. The IdP group will be disconnected from any teams on {% data variables.product.product_name %}.
* 将 Azure AD 上的 {% data variables.product.product_name %} 应用程序分配给用户帐户,以便在 {% data variables.product.product_name %} 上自动创建并授予对相应用户帐户的访问权限。
* 为 Azure AD 上的用户帐户取消分配 {% data variables.product.product_name %} 应用程序,以便在 {% data variables.product.product_name %} 上停用相应的用户帐户。
* 为 Azure AD 上的 IdP 组分配 {% data variables.product.product_name %} 应用程序,以便为 IdP 组的所有成员自动创建并授予对 {% data variables.product.product_name %} 上用户帐户的访问权限。 此外IdP 组也可以在 {% data variables.product.product_name %} 上连接到团队及其父组织。
* 从 IdP 组取消分配 {% data variables.product.product_name %} 应用程序来停用仅通过该 IdP 组访问的所有 IdP 用户的 {% data variables.product.product_name %} 用户帐户,并从父组织中删除这些用户。 IdP 组将与 {% data variables.product.product_name %} 上的任何团队断开连接。
For more information about managing identity and access for your enterprise on {% data variables.location.product_location %}, see "[Managing identity and access for your enterprise](/admin/authentication/managing-identity-and-access-for-your-enterprise)." For more information about synchronizing teams with IdP groups, see "[Synchronizing a team with an identity provider group](/organizations/organizing-members-into-teams/synchronizing-a-team-with-an-identity-provider-group)."
有关在{% data variables.location.product_location %}上管理企业的身份验证和访问控制的详细信息,请参阅“[管理企业的身份验证和访问控制](/admin/authentication/managing-identity-and-access-for-your-enterprise)”。 有关将团队与 IdP 组同步的详细信息,请参阅“[将团队与标识提供者组同步](/organizations/organizing-members-into-teams/synchronizing-a-team-with-an-identity-provider-group)”。
## Prerequisites
## 先决条件
- To configure authentication and user provisioning for {% data variables.product.product_name %} using Azure AD, you must have an Azure AD account and tenant. For more information, see the [Azure AD website](https://azure.microsoft.com/free/active-directory) and [Quickstart: Create an Azure Active Directory tenant](https://docs.microsoft.com/azure/active-directory/develop/quickstart-create-new-tenant) in the Microsoft Docs.
- 要使用 Azure AD 配置 {% data variables.product.product_name %} 的身份验证和用户预配,您必须有 Azure AD 帐户和租户。 有关详细信息,请参阅 [Azure AD 网站](https://azure.microsoft.com/free/active-directory)和 Microsoft Docs 中的[快速入门:创建 Azure Active Directory 租户](https://docs.microsoft.com/azure/active-directory/develop/quickstart-create-new-tenant)
{%- ifversion scim-for-ghes %}
- {% data reusables.saml.ghes-you-must-configure-saml-sso %}
{%- endif %}
- {% data reusables.saml.ghes-you-must-configure-saml-sso %} {%- endif %}
- {% data reusables.saml.create-a-machine-user %}
## Configuring authentication and user provisioning with Azure AD
## 使用 Azure AD 配置身份验证和用户预配
In your Azure AD tenant, add the application for {% data variables.product.product_name %}, then configure provisioning.
Azure AD 租户中,添加 {% data variables.product.product_name %} 的应用程序,然后配置预配。
{% ifversion ghae %}
1. In Azure AD, add the {% data variables.enterprise.ae_azure_ad_app_link %} to your tenant and configure single sign-on. For more information, see [Tutorial: Azure Active Directory single sign-on (SSO) integration with {% data variables.product.product_name %}](https://docs.microsoft.com/azure/active-directory/saas-apps/github-ae-tutorial) in the Microsoft Docs.
1. Azure AD 中,将 {% data variables.enterprise.ae_azure_ad_app_link %} 添加到租户并配置单一登录。 有关详细信息,请参阅 Microsoft Docs 中的[教程Azure Active Directory 单一登录 (SSO) 与 {% data variables.product.product_name %} 的集成](https://docs.microsoft.com/azure/active-directory/saas-apps/github-ae-tutorial)
1. In {% data variables.product.product_name %}, enter the details for your Azure AD tenant.
1. {% data variables.product.product_name %} 中,输入 Azure AD 租户的详细信息。
- {% data reusables.saml.ae-enable-saml-sso-during-bootstrapping %}
- If you've already configured SAML SSO for {% data variables.location.product_location %} using another IdP and you want to use Azure AD instead, you can edit your configuration. For more information, see "[Configuring SAML single sign-on for your enterprise](/admin/authentication/configuring-saml-single-sign-on-for-your-enterprise#editing-the-saml-sso-configuration)."
- 如果已使用其他 IdP 为{% data variables.location.product_location %}配置 SAML SSO并且希望改为使用 Azure AD你可以编辑配置。 有关详细信息,请参阅“[为企业配置 SAML 单一登录](/admin/authentication/configuring-saml-single-sign-on-for-your-enterprise#editing-the-saml-sso-configuration)”。
1. Enable user provisioning in {% data variables.product.product_name %} and configure user provisioning in Azure AD. For more information, see "[Configuring user provisioning for your enterprise](/admin/authentication/configuring-user-provisioning-for-your-enterprise#enabling-user-provisioning-for-your-enterprise)."
1. {% data variables.product.product_name %} 中启用用户预配,并在 Azure AD 中配置用户预配。 有关详细信息,请参阅“[为企业配置用户预配](/admin/authentication/configuring-user-provisioning-for-your-enterprise#enabling-user-provisioning-for-your-enterprise)”。
{% elsif scim-for-ghes %}
1. In the Azure AD tenant, in the left sidebar, click **Provisioning**.
1. Azure AD 租户的左侧栏中,单击“预配”。
1. Under "Tenant URL", type the full endpoint URL for SCIM on {% data variables.location.product_location %}. For more information, see "[SCIM](/rest/enterprise-admin/scim#scim-endpoint-urls)" in the REST API documentation.
1. 在“租户 URL”下键入 {% data variables.location.product_location %}上 SCIM 的完整终结点 URL。 有关详细信息,请参阅 REST API 文档中的“[SCIM](/rest/enterprise-admin/scim#scim-endpoint-urls)”。
1. Under "Secret Token", type the {% data variables.product.pat_v1 %} that you created in step 4 of "[Configuring user provisioning with SCIM for your enterprise](/admin/identity-and-access-management/using-saml-for-enterprise-iam/configuring-user-provisioning-with-scim-for-your-enterprise#enabling-user-provisioning-for-your-enterprise)."
1. 在“机密令牌”下,输入在“[使用 SCIM 为企业配置用户配置](/admin/identity-and-access-management/using-saml-for-enterprise-iam/configuring-user-provisioning-with-scim-for-your-enterprise#enabling-user-provisioning-for-your-enterprise)”的步骤 4 中创建的{% data variables.product.pat_v1 %}。
1. To ensure a successful connection from Azure AD to {% data variables.location.product_location %}, Click **Test Connection**.
1. 要确保从 Azure AD 成功连接到 {% data variables.location.product_location %},请单击“测试连接”。
1. After you ensure a successful connection, at the top of the page, click **Save**.
1. 确保连接成功后,单击页面顶部的“保存”。
{% endif %}
1. Assign an enterprise owner for {% data variables.product.product_name %} in Azure AD. The process you should follow depends on whether you configured provisioning. For more information about enterprise owners, see "[Roles in an enterprise](/admin/user-management/managing-users-in-your-enterprise/roles-in-an-enterprise#enterprise-owners)."
- If you configured provisioning, to grant the user enterprise ownership in {% data variables.product.product_name %}, assign the enterprise owner role to the user in Azure AD.
- If you did not configure provisioning, to grant the user enterprise ownership in {% data variables.product.product_name %}, include the `administrator` attribute in the SAML assertion for the user account on the IdP, with the value of `true`. For more information about including the `administrator` attribute in the SAML claim from Azure AD, see [How to: customize claims issued in the SAML token for enterprise applications](https://docs.microsoft.com/azure/active-directory/develop/active-directory-saml-claims-customization) in the Microsoft Docs.
1. 在 Azure AD 中为 {% data variables.product.product_name %} 分配企业所有者。 应遵循的过程取决于你是否配置了预配。 有关企业所有者的详细信息,请参阅“[企业中的角色](/admin/user-management/managing-users-in-your-enterprise/roles-in-an-enterprise#enterprise-owners)”。
- 如果配置了预配,要向用户授予 {% data variables.product.product_name %} 中的企业所有权,请在 Azure AD 中为用户分配企业所有者角色。
- 如果未配置预配,要向用户授予 {% data variables.product.product_name %} 中的企业所有权,请在 IdP 上的用户帐户的 SAML 断言中包含 `administrator` 属性,其值为 `true`。 有关在 Azure AD 的 SAML 声明中包含 `administrator` 属性的详细信息,请参阅 Microsoft Docs 中的[如何:为企业应用程序自定义 SAML 令牌中颁发的声明](https://docs.microsoft.com/azure/active-directory/develop/active-directory-saml-claims-customization)

View File

@@ -73,7 +73,7 @@ featuredLinks:
- '{% ifversion ghae %}/admin/user-management/auditing-users-across-your-enterprise{% endif %}'
- /admin/identity-and-access-management/managing-iam-for-your-enterprise/about-authentication-for-your-enterprise
- /admin/policies/enforcing-policies-for-your-enterprise/about-enterprise-policies
- '{% ifversion ghae %}/admin/configuration/restricting-network-traffic-to-your-enterprise{% endif %}'
- '{% ifversion ghae %}/admin/configuration/restricting-network-traffic-to-your-enterprise-with-an-ip-allow-list{% endif %}'
- '{% ifversion ghes %}/admin/configuration/configuring-backups-on-your-appliance{% endif %}'
- '{% ifversion ghes %}/admin/enterprise-management/creating-a-high-availability-replica{% endif %}'
- '{% ifversion ghes %}/admin/overview/about-upgrades-to-new-releases{% endif %}'
@@ -125,11 +125,11 @@ children:
- /guides
- /release-notes
- /all-releases
ms.openlocfilehash: 3980ad01e56bf1e38dd6473c5e5246c6d45350eb
ms.sourcegitcommit: 3268914369fb29540e4d88ee5e56bc7a41f2a60e
ms.openlocfilehash: 0a84555b92c4645807d082f0d7f9348dfd3fc4bf
ms.sourcegitcommit: c562c85cc75ffe1eb4e9595d8adc09ec71697ab1
ms.translationtype: HT
ms.contentlocale: zh-CN
ms.lasthandoff: 10/26/2022
ms.locfileid: '148111306'
ms.lasthandoff: 11/22/2022
ms.locfileid: '148179979'
---

View File

@@ -0,0 +1,73 @@
---
title: 标识由访问令牌执行的审核日志事件
shortTitle: Identify events by token
intro: '可以在企业中标识由特定 {% data variables.product.pat_generic %} 或 OAuth 令牌执行的操作。'
versions:
feature: token-audit-log
ms.openlocfilehash: 4452e740e611ea3f903c5d122222b3cb575ba37d
ms.sourcegitcommit: e8c012864f13f9146e53fcb0699e2928c949ffa8
ms.translationtype: HT
ms.contentlocale: zh-CN
ms.lasthandoff: 11/09/2022
ms.locfileid: '148159496'
---
## 关于审核日志中的令牌数据
在企业的审核日志中,对于使用 {% data variables.product.pat_generic %} 或 OAuth 应用程序进行身份验证所执行的任何操作,事件数据将显示所使用的身份验证方法和令牌的 SHA-256 哈希值。
如果得知某个令牌已被盗用,可以通过在企业的审核日志中搜索与该令牌相关联的所有事件,来了解由被盗用的令牌执行的操作。
导出审核日志时不包括经过哈希处理的令牌值。
## 搜索与令牌关联的事件
在搜索与特定令牌关联的事件时,可以使用 UI 或 REST API。 在任一情况下,都需要先了解令牌的 SHA-256 哈希值。
### 为令牌生成 SHA-256 哈希值
如果只有原始令牌值,则需要先生成 SHA-256 哈希值,然后才能搜索令牌。
对于 MacOS 和 Linux可使用 `echo -n TOKEN | openssl dgst -sha256 -binary | base64` 并将 TOKEN 替换为令牌值。
对于 Powershell可以使用以下脚本返回给定字符串的 SHA-256 哈希值。
```shell{:copy}
Param (
[Parameter(Mandatory=$true)]
[string]
$ClearString
)
$hasher = [System.Security.Cryptography.HashAlgorithm]::Create('sha256')
$hash = $hasher.ComputeHash([System.Text.Encoding]::UTF8.GetBytes($ClearString))
$hashString = [System.BitConverter]::ToString($hash)
$hashString.Replace('-', '')
```
### 在 {% data variables.product.prodname_dotcom %} 上进行搜索
在 {% data variables.product.prodname_dotcom %} 上搜索审核日志时,在搜索查询中添加 `hashed_token:"VALUE"`,并将 `VALUE` 替换为令牌的 SHA-256 哈希值。
{% note %}
注意:确保将经过哈希处理的令牌值用引号括起来。
{% endnote %}
### 使用 REST API 进行搜索
在生成 SHA-256 哈希值后,还需要对该哈希值进行 URI 转义,然后才能使用 REST API 搜索令牌。 大多数主要的编程语言都提供了用于 URI 转义的实用工具。 例如,[encodeURIComponent()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/encodeURIComponent) 会对 JavaScript 字符串进行编码。
然后,在搜索短语中添加 `hashed_token:"VALUE"`,并将 VALUE 替换为 URI 转义的哈希。
例如,如果企业帐户的名称为 `octo-corp`,则以下 curl 命令将在 @octo-corp 的审核日志中搜索与令牌相关联的所有事件,该令牌的 URI 编码的 SHA-256 哈希值为 `EH4L8o6PfCqipALbL%2BQT62lyqUtnI7ql0SPbkaQnjv8`
```
curl --location --request GET 'https://api.github.com/enterprises/octo-corp/audit-log?phrase=hashed_token:"EH4L8o6PfCqipALbL%2BQT62lyqUtnI7ql0SPbkaQnjv8"' \
--header 'Authorization: Basic TOKEN' \
```
## 延伸阅读
- [在企业中使用审核日志 API](/admin/monitoring-activity-in-your-enterprise/reviewing-audit-logs-for-your-enterprise/using-the-audit-log-api-for-your-enterprise)

View File

@@ -1,6 +1,6 @@
---
title: Quickstart for configuring your MinIO storage bucket for GitHub Packages
intro: 'Configure your custom MinIO storage bucket for use with {% data variables.product.prodname_registry %}.'
title: 为 GitHub Packages 配置 MinIO 存储桶的快速入门
intro: '配置您的自定义 MinIO 存储桶,用于 {% data variables.product.prodname_registry %}'
versions:
ghes: '*'
type: quick_start
@@ -9,43 +9,48 @@ topics:
- Enterprise
- Storage
shortTitle: Quickstart for MinIO
ms.openlocfilehash: 2d26aa879b0a59d8c6bd4d80a04ec2aa30f8c422
ms.sourcegitcommit: 8f1801040a84ca9353899a2d1e6782c702aaed0d
ms.translationtype: HT
ms.contentlocale: zh-CN
ms.lasthandoff: 11/16/2022
ms.locfileid: '148166551'
---
{% data reusables.package_registry.packages-ghes-release-stage %}
Before you can enable and configure {% data variables.product.prodname_registry %} on {% data variables.location.product_location_enterprise %}, you need to prepare your third-party storage solution.
在 {% data variables.location.product_location_enterprise %} 上启用和配置 {% data variables.product.prodname_registry %} 之前,需要准备第三方存储解决方案。
MinIO offers object storage with support for the S3 API and {% data variables.product.prodname_registry %} on your enterprise.
MinIO 在企业上提供对象存储并支持 S3 API {% data variables.product.prodname_registry %}
This quickstart shows you how to set up MinIO using Docker for use with {% data variables.product.prodname_registry %} but you have other options for managing MinIO besides Docker. For more information about MinIO, see the official [MinIO docs](https://docs.min.io/).
此快速入门将演示如何使用 Docker 设置 MinIO 以与 {% data variables.product.prodname_registry %} 使用,但除了 Docker 之外,您还有其他用于管理 MinIO 的选项。 有关 MinIO 的详细信息,请参阅官方 [MinIO 文档](https://docs.min.io/)
## 1. Choose a MinIO mode for your needs
## 1. 根据需求选择 MinIO 模式
| MinIO mode | Optimized for | Storage infrastructure required |
| MinIO 模式 | 优化对象 | 需要存储基础架构 |
|----|----|----|
| Standalone MinIO (on a single host) | Fast setup | N/A |
| Clustered MinIO (also called Distributed MinIO)| Data security | Storage servers running in a cluster |
| 独立 MinIO在单个主机上 | 快速设置 | 空值 |
| 群集式 MinIO也称为分布式 MinIO| 数据安全性 | 在群集中运行的存储服务器 |
For more information about your options, see the official [MinIO docs](https://docs.min.io/).
有关选项的详细信息,请参阅官方 [MinIO 文档](https://docs.min.io/)
## 2. Install, run, and sign in to MinIO
## 2. 安装、运行和登录到 MinIO
1. Set up your preferred environment variables for MinIO.
1. 为 MinIO 设置首选环境变量。
These examples use `MINIO_DIR`:
这些示例使用 `MINIO_DIR`
```shell
$ export MINIO_DIR=$(pwd)/minio
$ mkdir -p $MINIO_DIR
```
2. Install MinIO.
2. 安装 MinIO
```shell
$ docker pull minio/minio
```
For more information, see the official "[MinIO Quickstart Guide](https://docs.min.io/docs/minio-quickstart-guide)."
有关详细信息,请参阅官方“[MinIO 快速入门指南](https://docs.min.io/docs/minio-quickstart-guide)”。
3. Sign in to MinIO using your MinIO access key and secret.
3. 使用您的 MinIO 访问密钥登录 MinIO。
{% linux %}
```shell
@@ -63,16 +68,16 @@ For more information about your options, see the official [MinIO docs](https://d
```
{% endmac %}
You can access your MinIO keys using the environment variables:
您可以使用环境变量访问 MinIO 密钥:
```shell
$ echo $MINIO_ACCESS_KEY
$ echo $MINIO_SECRET_KEY
```
4. Run MinIO in your chosen mode.
4. 在您选择的模式下运行 MinIO。
* Run MinIO using Docker on a single host:
* 在单一主机上使用 Docker 运行 MinIO
```shell
$ docker run -p 9000:9000 \
@@ -82,42 +87,42 @@ For more information about your options, see the official [MinIO docs](https://d
minio/minio server /data
```
For more information, see "[MinIO Docker Quickstart guide](https://docs.min.io/docs/minio-docker-quickstart-guide.html)."
有关详细信息,请参阅“[MinIO Docker 快速入门指南](https://docs.min.io/docs/minio-docker-quickstart-guide.html)”。
* Run MinIO using Docker as a cluster. This MinIO deployment uses several hosts and MinIO's erasure coding for the strongest data protection. To run MinIO in a cluster mode, see the "[Distributed MinIO Quickstart Guide](https://docs.min.io/docs/distributed-minio-quickstart-guide.html)."
* 使用 Docker 作为集群运行 MinIO 此 MinIO 部署使用多个主机和 MinIO 的擦除编码来提供最强的数据保护。 若要在群集模式下运行 MinIO请参阅“[分布式 MinIO 快速入门指南](https://docs.min.io/docs/distributed-minio-quickstart-guide.html)”。
## 3. Create your MinIO bucket for {% data variables.product.prodname_registry %}
## 3. {% data variables.product.prodname_registry %} 创建 MinIO 存储桶
1. Install the MinIO client.
1. 安装 MinIO 客户端。
```shell
$ docker pull minio/mc
```
2. Create a bucket with a host URL that {% data variables.product.prodname_ghe_server %} can access.
2. 使用 {% data variables.product.prodname_ghe_server %} 可以访问的主机 URL 创建存储桶。
* Local deployments example:
* 本地部署示例:
```shell
$ export MC_HOST_minio="http://${MINIO_ACCESS_KEY}:${MINIO_SECRET_KEY} @localhost:9000"
$ docker run minio/mc BUCKET-NAME
```
This example can be used for MinIO standalone.
此示例可用于 MinIO 单机版。
* Clustered deployments example:
* 集群部署示例:
```shell
$ export MC_HOST_minio="http://${MINIO_ACCESS_KEY}:${MINIO_SECRET_KEY} @minioclustername.example.com:9000"
$ docker run minio/mc mb packages
```
## Next steps
## 后续步骤
To finish configuring storage for {% data variables.product.prodname_registry %}, you'll need to copy the MinIO storage URL:
要完成 {% data variables.product.prodname_registry %} 的存储配置,您需要复制 MinIO 存储 URL
```
echo "http://${MINIO_ACCESS_KEY}:${MINIO_SECRET_KEY}@minioclustername.example.com:9000"
```
For the next steps, see "[Enabling {% data variables.product.prodname_registry %} with MinIO](/admin/packages/enabling-github-packages-with-minio)."
有关后续步骤,请参阅“[使用 MinIO 启用 {% data variables.product.prodname_registry %}](/admin/packages/enabling-github-packages-with-minio)”。

View File

@@ -25,7 +25,7 @@ shortTitle: Policies for security settings
## About policies for security settings in your enterprise
You can enforce policies to control the security settings for organizations owned by your enterprise on {% data variables.product.product_name %}. By default, organization owners can manage security settings. For more information, see "[Keeping your organization secure](/organizations/keeping-your-organization-secure)."
You can enforce policies to control the security settings for organizations owned by your enterprise on {% data variables.product.product_name %}. By default, organization owners can manage security settings.
{% ifversion ghec or ghes %}
@@ -59,93 +59,6 @@ Before you require use of two-factor authentication, we recommend notifying orga
{% endif %}
{% ifversion ghec or ghae %}
## Managing allowed IP addresses for organizations in your enterprise
{% ifversion ghae %}
You can restrict network traffic to your enterprise on {% data variables.product.product_name %}. For more information, see "[Restricting network traffic to your enterprise](/admin/configuration/configuring-your-enterprise/restricting-network-traffic-to-your-enterprise)."
{% elsif ghec %}
Enterprise owners can restrict access to private assets owned by organizations in an enterprise by configuring an allow list for specific IP addresses. {% data reusables.identity-and-permissions.ip-allow-lists-example-and-restrictions %}
{% data reusables.identity-and-permissions.ip-allow-lists-cidr-notation %}
{% data reusables.identity-and-permissions.ip-allow-lists-enable %} {% data reusables.identity-and-permissions.ip-allow-lists-enterprise %}
You can also configure allowed IP addresses for an individual organization. For more information, see "[Managing allowed IP addresses for your organization](/organizations/keeping-your-organization-secure/managing-allowed-ip-addresses-for-your-organization)."
### Adding an allowed IP address
{% data reusables.identity-and-permissions.about-adding-ip-allow-list-entries %}
{% data reusables.identity-and-permissions.ipv6-allow-lists %}
{% data reusables.enterprise-accounts.access-enterprise %}
{% data reusables.enterprise-accounts.settings-tab %}
{% data reusables.enterprise-accounts.security-tab %}
{% data reusables.identity-and-permissions.ip-allow-lists-add-ip %}
{% data reusables.identity-and-permissions.ip-allow-lists-add-description %}
{% data reusables.identity-and-permissions.ip-allow-lists-add-entry %}
{% data reusables.identity-and-permissions.check-ip-address %}
### Allowing access by {% data variables.product.prodname_github_apps %}
{% data reusables.identity-and-permissions.ip-allow-lists-githubapps-enterprise %}
### Enabling allowed IP addresses
{% data reusables.identity-and-permissions.about-enabling-allowed-ip-addresses %}
{% data reusables.enterprise-accounts.access-enterprise %}
{% data reusables.enterprise-accounts.settings-tab %}
{% data reusables.enterprise-accounts.security-tab %}
3. Under "IP allow list", select **Enable IP allow list**.
![Checkbox to allow IP addresses](/assets/images/help/security/enable-ip-allowlist-enterprise-checkbox.png)
4. Click **Save**.
### Editing an allowed IP address
{% data reusables.identity-and-permissions.about-editing-ip-allow-list-entries %}
{% data reusables.enterprise-accounts.access-enterprise %}
{% data reusables.enterprise-accounts.settings-tab %}
{% data reusables.enterprise-accounts.security-tab %}
{% data reusables.identity-and-permissions.ip-allow-lists-edit-entry %}
{% data reusables.identity-and-permissions.ip-allow-lists-edit-ip %}
{% data reusables.identity-and-permissions.ip-allow-lists-edit-description %}
8. Click **Update**.
{% data reusables.identity-and-permissions.check-ip-address %}
{% ifversion ip-allow-list-address-check %}
### Checking if an IP address is permitted
{% data reusables.identity-and-permissions.about-checking-ip-address %}
{% data reusables.enterprise-accounts.access-enterprise %}
{% data reusables.enterprise-accounts.settings-tab %}
{% data reusables.enterprise-accounts.security-tab %}
{% data reusables.identity-and-permissions.check-ip-address-step %}
{% endif %}
### Deleting an allowed IP address
{% data reusables.enterprise-accounts.access-enterprise %}
{% data reusables.enterprise-accounts.settings-tab %}
{% data reusables.enterprise-accounts.security-tab %}
{% data reusables.identity-and-permissions.ip-allow-lists-delete-entry %}
{% data reusables.identity-and-permissions.ip-allow-lists-confirm-deletion %}
### Using {% data variables.product.prodname_actions %} with an IP allow list
{% data reusables.actions.ip-allow-list-self-hosted-runners %}
{% endif %}
{% endif %}
## Managing SSH certificate authorities for your enterprise
You can use a SSH certificate authorities (CA) to allow members of any organization owned by your enterprise to access that organization's repositories using SSH certificates you provide. {% data reusables.organizations.can-require-ssh-cert %} For more information, see "[About SSH certificate authorities](/organizations/managing-git-access-to-your-organizations-repositories/about-ssh-certificate-authorities)."
@@ -197,5 +110,7 @@ To prevent confusion from your developers, you can change this behavior so that
## Further reading
- "[About identity and access management for your enterprise](/admin/authentication/managing-identity-and-access-for-your-enterprise/about-identity-and-access-management-for-your-enterprise)"{% ifversion ghec %}
- "[Accessing compliance reports for your enterprise](/admin/overview/accessing-compliance-reports-for-your-enterprise)"{% endif %}
{% endif %}
- "[Accessing compliance reports for your enterprise](/admin/overview/accessing-compliance-reports-for-your-enterprise)"{%- endif %}
- "[Keeping your organization secure](/organizations/keeping-your-organization-secure)"
- "[Restricting network traffic with an IP allow list with an IP allow list](/admin/configuration/configuring-your-enterprise/restricting-network-traffic-to-your-enterprise-with-an-ip-allow-list)"
{%- endif %}

View File

@@ -1,6 +1,6 @@
---
title: Viewing and managing your active SAML sessions
intro: You can view and revoke your active SAML sessions in your settings.
title: 查看和管理活动的 SAML 会话
intro: 可以在设置中查看和撤销活动的 SAML 会话。
redirect_from:
- /articles/viewing-and-managing-your-active-saml-sessions
- /github/authenticating-to-github/viewing-and-managing-your-active-saml-sessions
@@ -11,29 +11,33 @@ topics:
- SSO
type: how_to
shortTitle: Active SAML sessions
ms.openlocfilehash: e69ad366de7cdfb14b6a2a13ae3bdc134111616a
ms.sourcegitcommit: b2e5d14036a700b781e91158a552f8c0b1f04839
ms.translationtype: HT
ms.contentlocale: zh-CN
ms.lasthandoff: 11/15/2022
ms.locfileid: '148165577'
---
可以查看已登录到帐户的设备列表,并撤销无法识别的任何 SAML 会话。
You can view a list of devices that have logged into your account, and revoke any SAML sessions that you don't recognize.
{% data reusables.user-settings.access_settings %} {% data reusables.user-settings.sessions %}
1. 在“Web 会话”下,可以看到活动的 SAML 会话。
{% data reusables.user-settings.access_settings %}
{% data reusables.user-settings.sessions %}
1. Under "Web sessions," you can see your active SAML sessions.
![活动 SAML 会话列表的屏幕截图](/assets/images/help/settings/saml-active-sessions.png)
![Screenshot of the list of active SAML sessions](/assets/images/help/settings/saml-active-sessions.png)
1. 若要查看会话详细信息,请单击“查看更多”。
![活动 SAML 会话的屏幕截图,其中突出显示了用于打开 SAML 会话详细信息的按钮](/assets/images/help/settings/saml-expand-session-details.png)
1. To see the session details, click **See more**.
![Screenshot of the active SAML sessions with the button to open SAML session details emphasized](/assets/images/help/settings/saml-expand-session-details.png)
1. 若要撤销会话,请单击“撤销 SAML”。
1. To revoke a session, click **Revoke SAML**.
![Screenshot of the Session details page with the button to revoke a SAML session emphasized](/assets/images/help/settings/saml-revoke-session.png)
![“会话详细信息”页的屏幕截图,其中突出显示了用于撤销 SAML 会话的按钮](/assets/images/help/settings/saml-revoke-session.png)
{% note %}
**Note:** When you revoke a session, you remove your SAML authentication to that organization. To access the organization again, you will need to single sign-on through your identity provider. For more information, see "[About authentication with SAML SSO](/github/authenticating-to-github/about-authentication-with-saml-single-sign-on)."
**注意:** 撤销会话时,将删除对该组织的 SAML 身份验证。 要再次访问该组织,您需要通过身份提供程序单点登录。 有关详细信息,请参阅“[关于通过 SAML SSO 进行身份验证](/github/authenticating-to-github/about-authentication-with-saml-single-sign-on)”。
{% endnote %}
## Further reading
## 延伸阅读
- "[About authentication with SAML SSO](/github/authenticating-to-github/about-authentication-with-saml-single-sign-on)"
- [关于使用 SAML SSO 进行身份验证](/github/authenticating-to-github/about-authentication-with-saml-single-sign-on)

View File

@@ -1,6 +1,6 @@
---
title: Keeping your account and data secure
intro: 'To protect your personal information, you should keep both your account on {% ifversion ghae %}{% data variables.product.product_name %}{% else %}{% data variables.location.product_location %}{% endif %} and any associated data secure.'
title: 保护帐户和数据安全
intro: '为了保护个人信息,应该确保你在 {% ifversion ghae %}{% data variables.product.product_name %}{% else %}{% data variables.location.product_location %}{% endif %} 上的帐户和任何相关数据的安全。'
redirect_from:
- /articles/keeping-your-account-and-data-secure
- /github/authenticating-to-github/keeping-your-account-and-data-secure
@@ -34,5 +34,11 @@ children:
- /preventing-unauthorized-access
- /viewing-and-managing-your-sessions
shortTitle: Account security
ms.openlocfilehash: ba88c5fcde2e1dcdcf7186c4e5d83bf854f9ff00
ms.sourcegitcommit: b2e5d14036a700b781e91158a552f8c0b1f04839
ms.translationtype: HT
ms.contentlocale: zh-CN
ms.lasthandoff: 11/15/2022
ms.locfileid: '148165544'
---

View File

@@ -0,0 +1,46 @@
---
title: 查看和管理会话
intro: 可以在设置中查看和撤销活动的会话。
versions:
feature: device-and-settings-management-page
type: how_to
topics:
- SSO
shortTitle: Viewing and managing sessions
ms.openlocfilehash: 15a0bdc17a913ceb6da27e8809610306adb1de25
ms.sourcegitcommit: b2e5d14036a700b781e91158a552f8c0b1f04839
ms.translationtype: HT
ms.contentlocale: zh-CN
ms.lasthandoff: 11/15/2022
ms.locfileid: '148165575'
---
可以查看已登录到帐户的设备列表,并撤销无法识别的任何会话。
{% data reusables.user-settings.access_settings %} {% data reusables.user-settings.sessions %}
1. 在“Web 会话”下,可以看到活动的 Web 会话。
![活动会话列表的屏幕截图](/assets/images/help/settings/saml-active-sessions.png) {% ifversion fpt or ghec %}在 “{% data variables.product.prodname_mobile %} 会话”下,可以看到通过 {% data variables.product.prodname_mobile %} 应用登录到帐户的设备列表。
![活动会话列表的屏幕截图](/assets/images/help/settings/github-mobile-active-sessions.png){% endif %}
1. 若要查看 Web 会话详细信息,请单击“查看更多”。
![“会话”页的屏幕截图,其中突出显示了用于打开会话详细信息的按钮](/assets/images/help/settings/saml-expand-session-details.png)
1. 若要撤销 Web 会话,请单击“撤销会话”。
![“会话详细信息”页的屏幕截图,其中突出显示了用于撤销会话的按钮](/assets/images/help/settings/revoke-session.png)
{% ifversion fpt or ghec %}
1. (可选)若要撤销 {% data variables.product.prodname_mobile %} 会话,请返回到“会话概述”页面,然后单击要撤销的设备旁边的“撤销”。
{% note %}
注意:撤销移动会话会使你从该设备上退出 {% data variables.product.prodname_mobile %} 应用程序,并将其作为第二因素选项移除。
{% endnote %}
![“会话”页的屏幕截图,其中突出显示了用于撤销移动会话的按钮](/assets/images/help/settings/revoke-mobile-session.png)
{% endif %}

View File

@@ -1,6 +1,6 @@
---
title: 将您的签名密钥告知 Git
intro: '要在本地对提交进行签名,需要向 Git 通知你要使用的 GPG{% ifversion ssh-commit-verification %}SSH{% endif %} X.509 密钥。'
title: Telling Git about your signing key
intro: 'To sign commits locally, you need to inform Git that there''s a GPG{% ifversion ssh-commit-verification %}, SSH,{% endif %} or X.509 key you''d like to use.'
redirect_from:
- /articles/telling-git-about-your-gpg-key
- /articles/telling-git-about-your-signing-key
@@ -15,39 +15,38 @@ topics:
- Identity
- Access management
shortTitle: Tell Git your signing key
ms.openlocfilehash: e78306bb1519f2b7f51ab6bc039bff0b982e48cf
ms.sourcegitcommit: a0ad3bfe2a99c3092e76ca9b3d476cf30988ca55
ms.translationtype: HT
ms.contentlocale: zh-CN
ms.lasthandoff: 10/28/2022
ms.locfileid: '148118993'
---
{% mac %}
## 将您的 GPG 密钥告知 Git
## Telling Git about your GPG key
如果您使用与您的提交者身份以及 {% ifversion ghae %}{% data variables.product.product_name %}{% else %}{% data variables.location.product_location %}{% endif %} 上帐户关联的已验证电子邮件地址相匹配的 GPG 密钥,则可以开始对提交和标签进行签名。
If you're using a GPG key that matches your committer identity and your verified email address associated with your account on {% ifversion ghae %}{% data variables.product.product_name %}{% else %}{% data variables.location.product_location %}{% endif %}, then you can begin signing commits and signing tags.
{% note %}
如果您没有与提交者身份匹配的 GPG 密钥,则需要将电子邮件与现有密钥关联。 有关详细信息,请参阅“[将电子邮件与 GPG 密钥关联](/articles/associating-an-email-with-your-gpg-key)”。
If you don't have a GPG key that matches your committer identity, you need to associate an email with an existing key. For more information, see "[Associating an email with your GPG key](/articles/associating-an-email-with-your-gpg-key)".
{% endnote %}
如果您有多个 GPG 密钥,则需要告知 Git 要使用哪一个。
If you have multiple GPG keys, you need to tell Git which one to use.
{% data reusables.command_line.open_the_multi_os_terminal %} {% data reusables.gpg.configure-gpg-signing %} {% data reusables.gpg.list-keys-with-note %} {% data reusables.gpg.copy-gpg-key-id %} {% data reusables.gpg.paste-gpg-key-id %} {% data reusables.gpg.set-auto-sign %}
1. 如果没有使用 GPG 套件,请在 `zsh` shell 中运行以下命令,将 GPG 密钥添加到 `.zshrc` 文件(如果存在)或 `.zprofile` 文件:
{% data reusables.command_line.open_the_multi_os_terminal %}
{% data reusables.gpg.configure-gpg-signing %}
{% data reusables.gpg.list-keys-with-note %}
{% data reusables.gpg.copy-gpg-key-id %}
{% data reusables.gpg.paste-gpg-key-id %}
{% data reusables.gpg.set-auto-sign %}
1. If you aren't using the GPG suite, run the following command in the `zsh` shell to add the GPG key to your `.zshrc` file, if it exists, or your `.zprofile` file:
```shell
$ if [ -r ~/.zshrc ]; then echo 'export GPG_TTY=$(tty)' >> ~/.zshrc; \
else echo 'export GPG_TTY=$(tty)' >> ~/.zprofile; fi
```
或者,如果使用 `bash` shell请运行以下命令
Alternatively, if you use the `bash` shell, run this command:
```shell
$ if [ -r ~/.bash_profile ]; then echo 'export GPG_TTY=$(tty)' >> ~/.bash_profile; \
else echo 'export GPG_TTY=$(tty)' >> ~/.profile; fi
```
1. (可选)若要在需要时提示你输入 PIN 或密码,请安装 `pinentry-mac`。 例如,使用 [Homebrew](https://brew.sh/)
1. Optionally, to prompt you to enter a PIN or passphrase when required, install `pinentry-mac`. For example, using [Homebrew](https://brew.sh/):
```shell
$ brew install pinentry-mac
$ echo "pinentry-program $(which pinentry-mac)" >> ~/.gnupg/gpg-agent.conf
@@ -58,56 +57,69 @@ ms.locfileid: '148118993'
{% windows %}
## 将您的 GPG 密钥告知 Git
## Telling Git about your GPG key
如果您使用与您的提交者身份以及 {% ifversion ghae %}{% data variables.product.product_name %}{% else %}{% data variables.location.product_location %}{% endif %} 上帐户关联的已验证电子邮件地址相匹配的 GPG 密钥,则可以开始对提交和标签进行签名。
If you're using a GPG key that matches your committer identity and your verified email address associated with your account on {% ifversion ghae %}{% data variables.product.product_name %}{% else %}{% data variables.location.product_location %}{% endif %}, then you can begin signing commits and signing tags.
{% note %}
如果您没有与提交者身份匹配的 GPG 密钥,则需要将电子邮件与现有密钥关联。 有关详细信息,请参阅“[将电子邮件与 GPG 密钥关联](/articles/associating-an-email-with-your-gpg-key)”。
If you don't have a GPG key that matches your committer identity, you need to associate an email with an existing key. For more information, see "[Associating an email with your GPG key](/articles/associating-an-email-with-your-gpg-key)".
{% endnote %}
如果您有多个 GPG 密钥,则需要告知 Git 要使用哪一个。
If you have multiple GPG keys, you need to tell Git which one to use.
{% data reusables.command_line.open_the_multi_os_terminal %} {% data reusables.gpg.configure-gpg-signing %} {% data reusables.gpg.list-keys-with-note %} {% data reusables.gpg.copy-gpg-key-id %} {% data reusables.gpg.paste-gpg-key-id %} {% data reusables.gpg.set-auto-sign %}
{% data reusables.command_line.open_the_multi_os_terminal %}
{% data reusables.gpg.configure-gpg-signing %}
{% data reusables.gpg.list-keys-with-note %}
{% data reusables.gpg.copy-gpg-key-id %}
{% data reusables.gpg.paste-gpg-key-id %}
{% data reusables.gpg.set-auto-sign %}
{% endwindows %}
{% linux %}
## 将您的 GPG 密钥告知 Git
## Telling Git about your GPG key
如果您使用与您的提交者身份以及 {% ifversion ghae %}{% data variables.product.product_name %}{% else %}{% data variables.location.product_location %}{% endif %} 上帐户关联的已验证电子邮件地址相匹配的 GPG 密钥,则可以开始对提交和标签进行签名。
If you're using a GPG key that matches your committer identity and your verified email address associated with your account on {% ifversion ghae %}{% data variables.product.product_name %}{% else %}{% data variables.location.product_location %}{% endif %}, then you can begin signing commits and signing tags.
{% note %}
如果您没有与提交者身份匹配的 GPG 密钥,则需要将电子邮件与现有密钥关联。 有关详细信息,请参阅“[将电子邮件与 GPG 密钥关联](/articles/associating-an-email-with-your-gpg-key)”。
If you don't have a GPG key that matches your committer identity, you need to associate an email with an existing key. For more information, see "[Associating an email with your GPG key](/articles/associating-an-email-with-your-gpg-key)".
{% endnote %}
如果您有多个 GPG 密钥,则需要告知 Git 要使用哪一个。
If you have multiple GPG keys, you need to tell Git which one to use.
{% data reusables.command_line.open_the_multi_os_terminal %} {% data reusables.gpg.configure-gpg-signing %} {% data reusables.gpg.list-keys-with-note %} {% data reusables.gpg.copy-gpg-key-id %} {% data reusables.gpg.paste-gpg-key-id %} {% data reusables.gpg.set-auto-sign %}
1. 若要将 GPG 密钥添加到 `.bashrc` 启动文件,请运行以下命令:
{% data reusables.command_line.open_the_multi_os_terminal %}
{% data reusables.gpg.configure-gpg-signing %}
{% data reusables.gpg.list-keys-with-note %}
{% data reusables.gpg.copy-gpg-key-id %}
{% data reusables.gpg.paste-gpg-key-id %}
{% data reusables.gpg.set-auto-sign %}
1. To add your GPG key to your `.bashrc` startup file, run the following command:
```bash
$ [ -f ~/.bashrc ] && echo 'export GPG_TTY=$(tty)' >> ~/.bashrc
```
{% endlinux %} {% ifversion ssh-commit-verification %}
{% endlinux %}
{% ifversion ssh-commit-verification %}
## 将 SSH 密钥告知 Git
## Telling Git about your SSH key
可以使用现有 SSH 密钥对提交和标记进行签名,或生成专用于签名的新密钥。 有关详细信息,请参阅“[生成新的 SSH 密钥并将其添加到 ssh-agent](/github/authenticating-to-github/generating-a-new-ssh-key-and-adding-it-to-the-ssh-agent)”。
You can use an existing SSH key to sign commits and tags, or generate a new one specifically for signing. For more information, see "[Generating a new SSH key and adding it to the ssh-agent](/github/authenticating-to-github/generating-a-new-ssh-key-and-adding-it-to-the-ssh-agent)."
{% data reusables.gpg.ssh-git-version %}
{% data reusables.command_line.open_the_multi_os_terminal %} {% data reusables.gpg.configure-ssh-signing %} {% data reusables.gpg.copy-ssh-public-key %} {% data reusables.gpg.paste-ssh-public-key %}
{% data reusables.command_line.open_the_multi_os_terminal %}
{% data reusables.gpg.configure-ssh-signing %}
{% data reusables.gpg.paste-ssh-public-key %}
{% endif %}
{% data reusables.gpg.x-509-key %}
## 延伸阅读
## Further reading
- [为 GitHub 帐户添加新的 SSH 密钥](/authentication/connecting-to-github-with-ssh/adding-a-new-ssh-key-to-your-github-account)”。
- [对提交签名](/articles/signing-commits)
- [对标记签名](/articles/signing-tags)
- "[Adding a new SSH key to your GitHub account](/authentication/connecting-to-github-with-ssh/adding-a-new-ssh-key-to-your-github-account)."
- "[Signing commits](/articles/signing-commits)"
- "[Signing tags](/articles/signing-tags)"

View File

@@ -52,30 +52,24 @@ A time-based one-time password (TOTP) application automatically generates an aut
{% data reusables.user-settings.access_settings %}
{% data reusables.user-settings.security %}
{% data reusables.two_fa.enable-two-factor-authentication %}
{%- ifversion fpt or ghec or ghes %}
{%- ifversion fpt or ghec or ghes > 3.7 %}
5. Under "Setup authenticator app", do one of the following:
- Scan the QR code with your mobile device's app. After scanning, the app displays a six-digit code that you can enter on {% data variables.product.product_name %}.
- If you can't scan the QR code, click **enter this text code** to see a code that you can manually enter in your TOTP app instead.
![Click enter this code](/assets/images/help/2fa/2fa_wizard_app_click_code.png)
6. The TOTP mobile application saves your account on {% data variables.location.product_location %} and generates a new authentication code every few seconds. On {% data variables.product.product_name %}, type the code into the field under "Enter the six-digit code from the application".
![TOTP enter code field](/assets/images/help/2fa/2fa_wizard_app_enter_code.png)
{%- else %}
5. Under "Two-factor authentication", select **Set up using an app** and click **Continue**.
6. Under "Authentication verification", do one of the following:
- Scan the QR code with your mobile device's app. After scanning, the app displays a six-digit code that you can enter on {% data variables.product.product_name %}.
- If you can't scan the QR code, click **enter this text code** to see a code that you can manually enter in your TOTP app instead.
![Click enter this code](/assets/images/help/2fa/2fa_wizard_app_click_code.png)
7. The TOTP mobile application saves your account on {% data variables.location.product_location %} and generates a new authentication code every few seconds. On {% data variables.product.product_name %}, type the code into the field under "Enter the six-digit code from the application". If your recovery codes are not automatically displayed, click **Continue**.
7. The TOTP mobile application saves your account on {% data variables.location.product_location %} and generates a new authentication code every few seconds. On {% data variables.product.product_name %}, type the code into the field under "Enter the six-digit code from the application".
![TOTP enter code field](/assets/images/help/2fa/2fa_wizard_app_enter_code.png)
{% data reusables.two_fa.save_your_recovery_codes_during_2fa_setup %}
{%- else %}
5. On the Two-factor authentication page, click **Set up using an app**.
6. Save your recovery codes in a safe place. Your recovery codes can help you get back into your account if you lose access.
- To save your recovery codes on your device, click **Download**.
- To save a hard copy of your recovery codes, click **Print**.
- To copy your recovery codes for storage in a password manager, click **Copy**.
![List of recovery codes with option to download, print, or copy the codes](/assets/images/help/2fa/download-print-or-copy-recovery-codes-before-continuing.png)
7. After saving your two-factor recovery codes, click **Next**.
8. On the Two-factor authentication page, do one of the following:
- Scan the QR code with your mobile device's app. After scanning, the app displays a six-digit code that you can enter on {% data variables.product.product_name %}.
- If you can't scan the QR code, click **enter this text code** to see a code you can copy and manually enter on {% data variables.product.product_name %} instead.
![Click enter this code](/assets/images/help/2fa/totp-click-enter-code.png)
9. The TOTP mobile application saves your account on {% data variables.location.product_location %} and generates a new authentication code every few seconds. On {% data variables.product.product_name %}, on the 2FA page, type the code and click **Enable**.
![TOTP Enable field](/assets/images/help/2fa/totp-enter-code.png)
{%- endif %}
{% data reusables.two_fa.save_your_recovery_codes_during_2fa_setup %}
{% data reusables.two_fa.backup_options_during_2fa_enrollment %}
{% data reusables.two_fa.test_2fa_immediately %}
{% ifversion fpt or ghec %}
@@ -95,8 +89,11 @@ Before using this method, be sure that you can receive text messages. Carrier ra
{% data reusables.user-settings.access_settings %}
{% data reusables.user-settings.security %}
{% data reusables.two_fa.enable-two-factor-authentication %}
4. Under "Two-factor authentication", select **Set up using SMS** and click **Continue**.
5. Under "Authentication verification", select your country code and type your mobile phone number, including the area code. When your information is correct, click **Send authentication code**.
4. Below "Setup authenticator app", select **SMS authentication**
![2FA SMS alternative option](/assets/images/help/2fa/2fa_sms_alt_option.png)
5. Under "Setup SMS authentication", select your country code and type your mobile phone number, including the area code. When your information is correct, click **Send authentication code**.
![2FA SMS screen](/assets/images/help/2fa/2fa_wizard_sms_send.png)
@@ -104,6 +101,7 @@ Before using this method, be sure that you can receive text messages. Carrier ra
![2FA SMS continue field](/assets/images/help/2fa/2fa_wizard_sms_enter_code.png)
{% data reusables.two_fa.save_your_recovery_codes_during_2fa_setup %}
{% data reusables.two_fa.backup_options_during_2fa_enrollment %}
{% data reusables.two_fa.test_2fa_immediately %}
{% endif %}
@@ -128,8 +126,7 @@ Authentication with a security key is *secondary* to authentication with a TOTP
![Providing a nickname for a security key](/assets/images/help/2fa/security-key-nickname.png)
8. Activate your security key, following your security key's documentation.
![Prompt for a security key](/assets/images/help/2fa/security-key-prompt.png)
9. Confirm that you've downloaded and can access your recovery codes. If you haven't already, or if you'd like to generate another set of codes, download your codes and save them in a safe place. If you lose access to your account, you can use your recovery codes to get back into your account. For more information, see "[Recovering your account if you lose your 2FA credentials](/articles/recovering-your-account-if-you-lose-your-2fa-credentials)."
![Download recovery codes button](/assets/images/help/2fa/2fa-recover-during-setup.png)
9. Confirm that you've downloaded and can access your recovery codes. If you haven't already, or if you'd like to generate another set of codes, download your codes and save them in a safe place. For more information, see "[Downloading your 2FA recovery codes](/authentication/securing-your-account-with-two-factor-authentication-2fa/configuring-two-factor-authentication-recovery-methods#downloading-your-two-factor-authentication-recovery-codes)."
{% data reusables.two_fa.test_2fa_immediately %}
{% ifversion fpt or ghec %}

View File

@@ -1,7 +1,7 @@
---
title: Managing billing for GitHub Codespaces
title: 管理 GitHub Codespaces 的计费
shortTitle: Codespaces
intro: 'You can view your usage and set a spending limit for {% data variables.product.prodname_github_codespaces %}.'
intro: '你可以查看 {% data variables.product.prodname_github_codespaces %} 的使用情况并设置支出限制。'
versions:
fpt: '*'
ghec: '*'
@@ -9,5 +9,11 @@ children:
- /about-billing-for-github-codespaces
- /viewing-your-github-codespaces-usage
- /managing-the-spending-limit-for-github-codespaces
ms.openlocfilehash: 869239aefd5a2d244e7ff70735ad814802ed2616
ms.sourcegitcommit: e8c012864f13f9146e53fcb0699e2928c949ffa8
ms.translationtype: HT
ms.contentlocale: zh-CN
ms.lasthandoff: 11/09/2022
ms.locfileid: '148159091'
---

View File

@@ -0,0 +1,86 @@
---
title: 管理 GitHub Codespaces 的支出限制
intro: '可以为 {% data variables.product.prodname_github_codespaces %} 的使用设置支出限制。'
shortTitle: Spending limit
versions:
fpt: '*'
ghec: '*'
type: how_to
topics:
- Codespaces
- Enterprise
- Organizations
- Spending limits
- User account
- Billing
redirect_from:
- /billing/managing-billing-for-github-codespaces/managing-spending-limits-for-codespaces
- /billing/managing-billing-for-github-codespaces/managing-spending-limits-for-github-codespaces
ms.openlocfilehash: 87dd5204bb41ddaef911562cfb4662125e04139a
ms.sourcegitcommit: e8c012864f13f9146e53fcb0699e2928c949ffa8
ms.translationtype: HT
ms.contentlocale: zh-CN
ms.lasthandoff: 11/09/2022
ms.locfileid: '148159789'
---
## 关于 {% data variables.product.prodname_github_codespaces %} 的支出限制
{% data reusables.codespaces.codespaces-free-for-personal-intro %} 有关详细信息,请参阅“[关于 {% data variables.product.prodname_github_codespaces %} 的计费](/billing/managing-billing-for-github-codespaces/about-billing-for-github-codespaces)。”
{% data reusables.codespaces.codespaces-spending-limit-requirement %} {% data reusables.codespaces.codespaces-monthly-billing %}
达到支出限制后,将无法再创建新的 codespace也无法启动现有的 codespace。 仍在运行的任何现有 codespace 将在不久后关闭,但在达到支出限制后,不会向你收取使用费。
{% ifversion ghec %}
## 使用 Azure 订阅
如果通过 Microsoft 企业协议购买 {% data variables.product.prodname_enterprise %},可以将 Azure 订阅 ID 连接到企业帐户,以启用并支付 {% data variables.product.prodname_github_codespaces %} 使用费用。 有关详细信息,请参阅“[将 Azure 订阅连接到企业](/billing/managing-billing-for-your-github-account/connecting-an-azure-subscription-to-your-enterprise)”。
{% endif %}
## 管理个人帐户的 {% data variables.product.prodname_github_codespaces %} 支出限制
可以为个人帐户的 {% data variables.product.prodname_github_codespaces %} 设置支出限制。
{% data reusables.user-settings.access_settings %} {% data reusables.user-settings.billing_plans %} {% data reusables.dotcom_billing.manage-spending-limit %} {% data reusables.codespaces.monthly-spending-limit-codespaces %} {% data reusables.dotcom_billing.update-spending-limit %}
## 管理组织帐户的 {% data variables.product.prodname_github_codespaces %} 支出限制
组织所有者和帐单管理员可管理组织的 {% data variables.product.prodname_github_codespaces %} 支出限制。
{% note %}
注意:企业帐户拥有的组织不能指定其自己的支出限制,因为这是在企业设置中指定的。
{% endnote %}
{% data reusables.organizations.billing-settings %} {% data reusables.dotcom_billing.manage-spending-limit %} {% data reusables.codespaces.monthly-spending-limit-codespaces %} {% data reusables.dotcom_billing.update-spending-limit %}
{% ifversion ghec %}
## 管理企业帐户的 {% data variables.product.prodname_github_codespaces %} 支出限制
企业所有者和账单管理员可以管理企业帐户的 {% data variables.product.prodname_github_codespaces %} 的支出限制。
{% data reusables.enterprise-accounts.access-enterprise %} {% data reusables.enterprise-accounts.settings-tab %} {% data reusables.enterprise-accounts.billing-tab %}
1. 单击“支出限制”。
![“支出限制”选项卡](/assets/images/help/settings/spending-limit-tab-enterprise.png)
{% data reusables.codespaces.monthly-spending-limit-codespaces %} {% data reusables.dotcom_billing.update-spending-limit %} {% endif %}
## 在达到支出限制时导出更改
{% data reusables.codespaces.exporting-changes %}
## 管理使用和支出限制电子邮件通知
当支出达到帐户支出限制的 75%、90% 和 100% 时,系统会向帐户所有者和帐单管理员发送电子邮件通知。
可以随时关闭这些通知,方法是导航到“计费和计划/每月支出限制”页的底部,然后清除“支出限制警报”复选框。
仅对于个人帐户,还可以选择关闭在已使用个人帐户中包含的 75%、90% 和 100% 免费使用量时发送的电子邮件通知。 为此,请清除“包含的资源警报”复选框。
![帐单邮箱通知设置的屏幕截图](/assets/images/help/codespaces/codespaces-spending-limit-notifications.png)
## 延伸阅读
- “[限制对计算机类型的访问](/codespaces/managing-codespaces-for-your-organization/restricting-access-to-machine-types)”
- “[管理组织中的 {% data variables.product.prodname_github_codespaces %} 成本](/codespaces/managing-codespaces-for-your-organization/managing-the-cost-of-github-codespaces-in-your-organization)”

View File

@@ -1,7 +1,7 @@
---
title: Viewing your GitHub Codespaces usage
title: 查看 GitHub Codespaces 使用情况
shortTitle: Viewing your usage
intro: 'You can view the compute hours and storage used by {% data variables.product.prodname_github_codespaces %}.'
intro: '可以查看 {% data variables.product.prodname_github_codespaces %} 使用的计算小时数和存储空间。'
versions:
fpt: '*'
ghec: '*'
@@ -11,63 +11,64 @@ topics:
- Billing
redirect_from:
- /billing/managing-billing-for-github-codespaces/viewing-your-codespaces-usage
ms.openlocfilehash: 67e29ee71b1881ee2ae6e9ca872fd7969f86afca
ms.sourcegitcommit: e8c012864f13f9146e53fcb0699e2928c949ffa8
ms.translationtype: HT
ms.contentlocale: zh-CN
ms.lasthandoff: 11/09/2022
ms.locfileid: '148158739'
---
## 查看个人帐户的 {% data variables.product.prodname_github_codespaces %} 使用情况
## Viewing {% data variables.product.prodname_github_codespaces %} usage for your personal account
可以查看当前月度计费周期中到目前为止,个人帐户中的已使用量。 如果已设置付款方式、设置支出限制并使用了所有包含的使用量,则还可以检查当前月份的帐单。
You can see how much of the usage included in your personal account you have used so far in the current monthly billing cycle. If you have set up a payment method, set a spending limit, and used all of your included usage, you can also check your bill for the current month.
{% data reusables.user-settings.access_settings %} {% data reusables.user-settings.billing_plans %}
1. 在“{% data variables.product.prodname_codespaces %}”下,可以查看当前计费月份到目前为止使用的 {% data variables.product.prodname_github_codespaces %} 计算使用量和 GB/月存储的核心小时数。
{% data reusables.user-settings.access_settings %}
{% data reusables.user-settings.billing_plans %}
1. Under "{% data variables.product.prodname_codespaces %}," you can see how many core hours of {% data variables.product.prodname_github_codespaces %} compute usage and GB-months of storage you have used so far in the current billing month.
![个人使用量的初始视图的屏幕截图](/assets/images/help/codespaces/view-personal-usage-collapsed.png)
![Screenshot of the initial view of personal usage](/assets/images/help/codespaces/view-personal-usage-collapsed.png)
有关“核心小时数”和“GB/月”的详细信息,请参阅“[关于 {% data variables.product.prodname_github_codespaces %} 的计费](/enterprise-cloud@latest/billing/managing-billing-for-github-codespaces/about-billing-for-github-codespaces)”。
For information about "core hours" and "GB-months," see "[About billing for {% data variables.product.prodname_github_codespaces %}](/enterprise-cloud@latest/billing/managing-billing-for-github-codespaces/about-billing-for-github-codespaces)."
1. (可选)单击“使用小时数”和“存储”以查看更多详细信息 。
1. Optionally, click **Usage hours** and **Storage** to see more details.
![个人使用量的展开视图的屏幕截图](/assets/images/help/codespaces/view-personal-usage-expanded.png)
![Screenshot of the expanded view of personal usage](/assets/images/help/codespaces/view-personal-usage-expanded.png)
“包含”列显示本月到目前为止帐户中已使用的免费计算使用核心小时数或 GB/月存储。 “付费”列显示已使用的计费核心小时数或 GB/月存储。 这些数字每小时更新一次。
The **Included** column shows how many of the core hours of compute usage, or GB-months of storage, included free with your account, you have used so far this month. The **Paid** column shows how many billed core hours of usage, or GB-months of storage, you have used. The figures are updated once every hour.
In the screenshot above, the entire quota of included storage for the month has been used. When you've used all of either the included compute usage or storage (whichever is reached first), you must set up a payment method and a spending limit to continue using {% data variables.product.prodname_github_codespaces %} during the current billing month. For more information, see "[Adding or editing a payment method](/enterprise-cloud@latest/billing/managing-your-github-billing-settings/adding-or-editing-a-payment-method)" and "[Managing spending limits for {% data variables.product.prodname_github_codespaces %}](/billing/managing-billing-for-github-codespaces/managing-the-spending-limit-for-github-codespaces#managing-the-github-codespaces-spending-limit-for-your-personal-account)."
在上面的屏幕截图中,已使用当月包含的存储的全部配额。 使用完所有包含的计算使用量或存储(以先达到者为准)时,必须设置付款方式和支出限制才能在当前计费月份继续使用 {% data variables.product.prodname_github_codespaces %}。 有关详细信息,请参阅“[添加或编辑付款方式](/enterprise-cloud@latest/billing/managing-your-github-billing-settings/adding-or-editing-a-payment-method)”和“[管理 {% data variables.product.prodname_github_codespaces %} 的支出限制](/billing/managing-billing-for-github-codespaces/managing-the-spending-limit-for-github-codespaces#managing-the-github-codespaces-spending-limit-for-your-personal-account)”。
{% data reusables.codespaces.usage-report-download %}
## Viewing {% data variables.product.prodname_github_codespaces %} usage for your organization account
## 查看组织帐户的 {% data variables.product.prodname_github_codespaces %} 使用情况
Organization owners and billing managers can view {% data variables.product.prodname_github_codespaces %} usage for the organization.
组织所有者和账单管理员可查看组织的 {% data variables.product.prodname_github_codespaces %} 使用情况。
{% data reusables.organizations.billing-settings %}
1. Under "{% data variables.product.prodname_codespaces %}", view the details of the compute hours and storage used so far this month.
1. 在“{% data variables.product.prodname_codespaces %}”下,查看本月到目前为止使用的计算小时数和存储的详细信息。
![Screenshot of compute usage and storage details](/assets/images/help/billing/codespaces-compute-storage.png)
![计算使用量和存储详细信息的屏幕截图](/assets/images/help/billing/codespaces-compute-storage.png)
You can also see and update your current spending limit. For more information, see "[Managing spending limits for {% data variables.product.prodname_github_codespaces %}](/billing/managing-billing-for-github-codespaces/managing-the-spending-limit-for-github-codespaces)."
还可以查看和更新当前的支出限制。 有关详细信息,请参阅“[管理 {% data variables.product.prodname_github_codespaces %} 的支出限制](/billing/managing-billing-for-github-codespaces/managing-the-spending-limit-for-github-codespaces)”。
{% note %}
**Notes**:
* The costs shown here are the cumulative costs within the current monthly billing period. The metered costs for {% data variables.product.prodname_github_codespaces %} shown on this page are reset to zero at the start of each monthly billing period. Outstanding costs from previous months are not shown.
* The figures on this page are updated every hour.
**注释**
* 此处显示的成本是当前每月计费周期内的累计成本。 此页上显示的 {% data variables.product.prodname_github_codespaces %} 的计量成本会在每月计费周期开始时重置为零。 不显示前几个月的未结成本。
* 此页面上的数字每小时更新一次。
{% endnote %}
{% data reusables.codespaces.usage-report-download %}
{% ifversion ghec %}
## Viewing {% data variables.product.prodname_codespaces %} usage for your enterprise account
## 查看企业帐户的 {% data variables.product.prodname_codespaces %} 使用情况
Enterprise owners and billing managers can view {% data variables.product.prodname_github_codespaces %} usage for an enterprise account.
企业所有者和帐单管理员可查看企业帐户的 {% data variables.product.prodname_github_codespaces %} 使用情况。
{% data reusables.enterprise-accounts.access-enterprise %}
{% data reusables.enterprise-accounts.settings-tab %}
{% data reusables.enterprise-accounts.billing-tab %}
1. Under "{% data variables.product.prodname_codespaces %} monthly usage", view the usage details of each organization in your enterprise account.
{% data reusables.codespaces.usage-report-download %}
{% endif %}
{% data reusables.enterprise-accounts.access-enterprise %} {% data reusables.enterprise-accounts.settings-tab %} {% data reusables.enterprise-accounts.billing-tab %}
1. 在“{% data variables.product.prodname_codespaces %} 每月使用情况”下,查看企业帐户中每个组织的使用详细信息。
{% data reusables.codespaces.usage-report-download %} {% endif %}
## Further reading
## 延伸阅读
- "[Listing the codespaces in your organization](/codespaces/managing-codespaces-for-your-organization/listing-the-codespaces-in-your-organization)"
- [列出组织中的 codespace](/codespaces/managing-codespaces-for-your-organization/listing-the-codespaces-in-your-organization)

View File

@@ -57,15 +57,25 @@ For example, if your organization uses {% data variables.product.prodname_team %
At the end of the month, {% data variables.product.prodname_dotcom %} rounds your data transfer to the nearest GB.
{% data variables.product.prodname_dotcom %} calculates your storage usage for each month based on hourly usage during that month. For example, if you use 3 GB of storage for 10 days of March and 12 GB for 21 days of March, your storage usage would be:
{% data variables.product.prodname_dotcom %} calculates your storage usage for each month based on hourly usage per GB during that month. For example, if you use 3 GB of storage for 10 days of March and 12 GB for 21 days of March, your storage usage would be:
- 3 GB x 10 days x (24 hours per day) = 720 GB-Hours
- 12 GB x 21 days x (24 hours per day) = 6,048 GB-Hours
- 720 GB-Hours + 6,048 GB-Hours = 6,768 GB-Hours
- 720 GB-Hours + 6,048 GB-Hours = 6,768 total GB-Hours
- 6,768 GB-Hours / (744 hours per month) = 9.0967 GB-Months
At the end of the month, {% data variables.product.prodname_dotcom %} rounds your storage to the nearest MB. Therefore, your storage usage for March would be 9.097 GB.
You can also use this calculation in the middle of a billing cycle, to estimate what your total usage might be for the month. For example, if you have an organization that uses {% data variables.product.prodname_team %}, which provides 2 GB of free storage, and you use 0 GB for the first 5 days of April, 1.5 GB for the following 10 days, and you plan to use 3 GB for the last 15 days of the billing cycle, your projected storage usage for the month would be:
- 0 GB x 5 days x (24 hours per day) = 0 GB-Hours
- 0.5 GB x 10 days x (24 hours per day) = 120 GB-Hours
- 3 GB x 15 days x (24 hours per day) = 1080 GB-Hours
- 0 GB-Hours + 120 GB-Hours + 1080 GB-Hours = 1200 total GB-Hours
- 1200 GB-Hours / (744 hours per month) = 1.6 GB-Months
The projected 1.6 GB of storage usage for the month would not exceed your 2 GB limit, even though your actual storage amount briefly exceeded 2 GB.
Your {% data variables.product.prodname_registry %} usage shares your account's existing billing date, payment method, and receipt. {% data reusables.dotcom_billing.view-all-subscriptions %}
{% data reusables.user-settings.context_switcher %}
@@ -74,6 +84,12 @@ Your {% data variables.product.prodname_registry %} usage shares your account's
{% data reusables.package_registry.packages-spending-limit-detailed %}
For information on managing and changing your account's spending limit, see "[Managing your spending limit for {% data variables.product.prodname_registry %}](/billing/managing-billing-for-github-packages/managing-your-spending-limit-for-github-packages)."
To prevent exceeding your spending limit, {% data variables.product.prodname_dotcom %} checks your storage consumption continuously throughout the month by looking at your current usage and calculating what your projected usage will be at the end of the month if no changes are made before that time. If at any point during the billing cycle your projected monthly usage exceeds your spending limit, both {% data variables.product.prodname_registry %} and {% data variables.product.prodname_actions %} will be disabled to prevent overages.
{% data reusables.dotcom_billing.actions-packages-unpaid-account %}
You should set a spending limit that will cover your maximum projected storage usage at any given point in the billing cycle. For example, imagine you have an organization that uses {% data variables.product.prodname_team %}, and you set a spending limit of $50 USD. {% data variables.product.prodname_team %} provides 2 GB of free storage. For any storage you use over that amount, {% data variables.product.prodname_dotcom %} will charge $0.008 USD per GB per day, or approximately $0.25 USD per GB for a 31-day month. That means the $50 spending limit you set will pay for an extra 200 GB of storage in that period. If on day ten of the billing cycle you reach 202 GB of storage, the next push of a package or {% data variables.product.prodname_actions %} artifact will fail, because you have reached the maximum storage amount that can be paid for by your spending limit in this billing cycle, even if your average consumption for the period is below 202 GB.
To avoid reaching your spending limit in the current billing cycle, you can delete some of your current storage usage to free up projected usage for the rest of the month. This method is more effective toward the beginning of a billing cycle. The closer you get to the end of a billing cycle, the less impact this method will have on projected monthly usage.
For more information about managing and changing your account's spending limit, see "[Managing your spending limit for {% data variables.product.prodname_registry %}](/billing/managing-billing-for-github-packages/managing-your-spending-limit-for-github-packages)."
{% data reusables.dotcom_billing.actions-packages-unpaid-account %}

View File

@@ -22,7 +22,14 @@ For privacy reasons, enterprise owners cannot directly access the details of use
## About the calculation of consumed licenses
{% data variables.product.company_short %} bills for each person who uses deployments of {% data variables.product.prodname_ghe_server %}, is a member of one of your organizations on {% data variables.product.prodname_ghe_cloud %}, or is a {% data variables.visual_studio.prodname_vs_subscriber %}. For more information about the people in your enterprise who consume a license, see "[About per-user pricing](/billing/managing-billing-for-your-github-account/about-per-user-pricing)."
If a user meets one or more of the following conditions, {% data variables.product.company_short %} bills for the user.
- The user utilizes deployments of {% data variables.product.prodname_ghe_server %}.
- The user is a member of one of your organizations on {% data variables.product.prodname_ghe_cloud %}.
- The user has write access to one of your organization's private repositories.
- The user is a {% data variables.visual_studio.prodname_vs_subscriber %}.
Invitations for these roles will consume a license until the invitation is accepted or expires. For more information about the people in your enterprise who consume a license, see "[About per-user pricing](/billing/managing-billing-for-your-github-account/about-per-user-pricing)."
For each user to consume a single seat regardless of how many deployments they use, you must synchronize license usage between {% data variables.product.prodname_ghe_server %} and {% data variables.product.prodname_ghe_cloud %}. For more information, see "[Syncing license usage between {% data variables.product.prodname_ghe_server %} and {% data variables.product.prodname_ghe_cloud %}](/billing/managing-your-license-for-github-enterprise/syncing-license-usage-between-github-enterprise-server-and-github-enterprise-cloud)."

View File

@@ -62,7 +62,7 @@ You can also enable or disable {% data variables.product.prodname_dependabot_sec
You can override the default behavior of {% data variables.product.prodname_dependabot_security_updates %} by adding a dependabot.yml file to your repository. For more information, see "[Configuration options for the dependabot.yml file](/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file)."
If you only require security updates and want to exclude version updates, you can set `open-pull-request-limit` to `0` in order to prevent version updates for a given `package-ecosystem`. For more information, see "[`open-pull-request-limit`](/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file#open-pull-requests-limit)."
If you only require security updates and want to exclude version updates, you can set `open-pull-requests-limit` to `0` in order to prevent version updates for a given `package-ecosystem`. For more information, see "[`open-pull-requests-limit`](/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file#open-pull-requests-limit)."
```
# Example configuration file that:

View File

@@ -0,0 +1,98 @@
---
title: 关于安全漏洞的协调披露
intro: 漏洞披露是安全报告者与仓库维护者之间的协调工作。
redirect_from:
- /code-security/security-advisories/about-coordinated-disclosure-of-security-vulnerabilities
- /code-security/repository-security-advisories/about-coordinated-disclosure-of-security-vulnerabilities
- /code-security/security-advisories/repository-security-advisories/about-coordinated-disclosure-of-security-vulnerabilities
miniTocMaxHeadingLevel: 3
versions:
fpt: '*'
ghec: '*'
type: overview
topics:
- Security advisories
- Vulnerabilities
shortTitle: Coordinated disclosure
ms.openlocfilehash: 5f3e9983b3efcca68cb1b5c0bc5891a21f276216
ms.sourcegitcommit: e8c012864f13f9146e53fcb0699e2928c949ffa8
ms.translationtype: HT
ms.contentlocale: zh-CN
ms.lasthandoff: 11/09/2022
ms.locfileid: '148159463'
---
## 关于披露行业漏洞
{% data reusables.security-advisory.disclosing-vulnerabilities %}
漏洞的初始报告是私下发布的,并且只有在维护者确认问题后才会公布全部详细信息,最好提供补救或修补程序,有时会延迟,以便有更多的时间安装修补程序。 有关详细信息,请参阅 OWASP 备忘单系列网站上的“[关于漏洞披露的 OWASP 备忘单系列](https://cheatsheetseries.owasp.org/cheatsheets/Vulnerability_Disclosure_Cheat_Sheet.html#commercial-and-open-source-software)”。
### 漏洞报告者的最佳实践
私下向维护者报告漏洞是一项良好的做法。 如果可能,作为漏洞报告者,我们建议您避免:
- 公开披露漏洞而不给维护者补救的机会。
- 绕过维护者。
- 在代码的修复版可用之前披露漏洞。
- 在没有公共奖励方案的情况下,报告某个问题时期望得到补偿。
漏洞报告者如果已尝试联系维护者但未收到回复,或与已联系他们但被要求等待很久才能披露,则在一段时间后公开披露漏洞是可以接受的。
我们建议漏洞报告者在报告过程中明确说明其披露政策的条款。 即使漏洞报告者不遵守严格的政策,最好在预期漏洞披露的时间表上对维护者设定明确的期望。 有关披露策略的示例,请参阅 GitHub 安全实验室网站上的“[安全实验室披露策略](https://securitylab.github.com/advisories#policy)”。
### 维护者最佳实践
作为维护者,最佳做法是明确说明您想如何和在何处收到关于漏洞的报告。 如果此信息不可明确,但漏洞报告者不知道如何联系您,可能寻求从 git 提交历史记录中提取开发人员电子邮件地址,以尝试找到适当的安全联系人。 这可能导致摩擦、丢失报告或发布未解决的报告。
维护者应及时披露漏洞。 如果您的仓库存在安全漏洞,我们建议您:
- 在响应和披露中,将漏洞视为安全问题,而不是简单的错误。 例如,您需要明确提及问题在发布说明中是一个安全漏洞。
- 即使没有即时的调查资源,也应尽快确认收到漏洞报告。 这传递了这样一个信息:您可以快速响应并采取行动,并为您与漏洞报告者之间的其余互动设定了积极的基调。
- 当您验证报告的影响和真实性时,请让漏洞报告者参与。 漏洞报告者可能已经花时间考虑了各种情景中的漏洞,其中一些情况您自己可能都没有考虑过。
- 以你认为合适的方式解决这个问题,认真考虑漏洞报告者提出的任何关切和建议。 通常,漏洞报告者会了解没有安全研究背景时容易错过的某些角落案例和补救旁路。
- 始终将漏洞的发现归功于漏洞报告者。
- 目标是尽快发布修复。
- 确保您在披露漏洞时让更广泛的生态系统意识到问题及其补救措施。 在项目当前开发分支中修复已识别的安全问题,但提交或后续版本未明确标记为安全修复或发布的情况并不少见。 这可能给下游消费者造成问题。
发布安全漏洞的详细信息不会使维护者看起来很糟糕。 安全漏洞在软件中随处可见。用户会信任那些在其守则中明确制定了安全漏洞披露程序的维护者。
## 关于在 {% data variables.product.prodname_dotcom %} 上报告和披露项目中的漏洞
{% data variables.product.prodname_dotcom %} 上有两个可用的进程:
- 标准过程:漏洞报告者使用位于存储库安全策略中的联系人信息与存储库维护人员取得联系。 然后,如有需要,存储库维护人员将创建草案存储库公告。
- 私人漏洞报告:漏洞报告者通过提出草案存储库公告并提供其发现的详细信息,私下直接向存储库维护人员披露漏洞详细信息。
### 标准过程
在 {% data variables.product.prodname_dotcom_the_website %} 上报告和披露项目漏洞的流程如下:
如果您是要报告漏洞的漏洞报告者(例如安全研究人员),请先检查相关仓库是否有安全策略。 有关详细信息,请参阅“[关于安全策略](/code-security/getting-started/adding-a-security-policy-to-your-repository#about-security-policies)”。 如果有的话,请先了解该流程,然后再联系该仓库的安全团队。
如果没有安全策略,与维护者建立私人通信手段的最有效办法是制造一个要求优先安全联系的问题。 值得注意的是,这个问题将立即公开可见,所以它不应该包括任何有关漏洞的信息。 建立通信后,您可以建议维护者制定安全策略以供将来使用。
{% note %}
注意:如果我们收到 npm 包中的恶意软件报告,我们会尝试私下与你联系(仅适用于 npm。 如果您不及时解决问题,我们将予以披露。 有关详细信息,请参阅 npm Docs 网站上的“[报告 npm 包中的恶意软件](https://docs.npmjs.com/reporting-malware-in-an-npm-package)”。
{% endnote %}
如果您在 {% data variables.product.prodname_dotcom_the_website %} 中发现了安全漏洞,请通过我们协调的披露流程报告该漏洞。 有关详细信息,请参阅“[{% data variables.product.prodname_dotcom %} 安全 Bug 赏金](https://bounty.github.com/)”网站。
如果您是维护者, 您可以在管道开始时通过为您的仓库设置安全策略来掌控这一过程,或者以其他方式使安全报告说明清楚可用,例如在项目的 README 文件中。 有关添加安全策略的信息,请参阅“[关于安全策略](/code-security/getting-started/adding-a-security-policy-to-your-repository#about-security-policies)”。 如果没有安全策略,漏洞报告者可能会尝试向您发送电子邮件或以其他方式私下与您联系。 或者,有人可能会开一个(公共)议题讨论安全问题的细节。
作为维护者,要在您的代码中披露漏洞,请先在 {% data variables.product.prodname_dotcom %} 中软件包的仓库内创建安全通告。 {% data reusables.security-advisory.security-advisory-overview %} 有关详细信息,请参阅“[关于存储库安全公告](/code-security/repository-security-advisories/about-github-security-advisories-for-repositories)”。
要开始使用,请参阅“[创建存储库安全公告](/code-security/repository-security-advisories/creating-a-repository-security-advisory)”。
### 私人漏洞报告
{% data reusables.security-advisory.private-vulnerability-reporting-beta %}
{% data reusables.security-advisory.private-vulnerability-reporting-enable %}
私人漏洞报告为漏洞报告者提供了一种简单的方法,可以在 {% data variables.product.prodname_dotcom %} 中向存储库维护人员私下披露安全风险,并即时将该问题告知给存储库维护人员。 有关安全研究人员和存储库维护人员的详细信息,请分别参阅“[私下报告安全漏洞](/code-security/security-advisories/guidance-on-reporting-and-writing/privately-reporting-a-security-vulnerability)”和“[管理私下报告的安全漏洞](/code-security/security-advisories/guidance-on-reporting-and-writing/managing-privately-reported-security-vulnerabilities)”。
{% note %}
注意:如果包含漏洞的存储库未启用私人漏洞报告,则安全研究人员和存储库维护人员都需要按照上面“[标准过程](#standard-process)”部分中所述的说明进行操作。
{% endnote %}

View File

@@ -0,0 +1,45 @@
---
title: Managing privately reported security vulnerabilities
intro: Repository maintainers can manage security vulnerabilities that have been privately reported to them by security reseachers for repositories where private vulnerability reporting is enabled.
permissions: 'Anyone with admin permissions to a repository can see, review, and manage privately-reported vulnerabilities for the repository.'
versions:
fpt: '*'
ghec: '*'
type: how_to
miniTocMaxHeadingLevel: 3
topics:
- Security advisories
- Vulnerabilities
shortTitle: Manage vulnerability reports
---
{% data reusables.security-advisory.private-vulnerability-reporting-beta %}
{% data reusables.security-advisory.private-vulnerability-reporting-enable %}
## About privately reporting a security vulnerability
Private vulnerability reporting makes it easy for security researchers to report vulnerabilities directly to you using a simple form.
When a security researcher reports a vulnerability privately, you are notified and can choose to either accept it, ask more questions, or reject it. If you accept the report, you're ready to collaborate on a fix for the vulnerability in private with the security researcher.
## Managing security vulnerabilities that are privately reported
{% data variables.product.prodname_dotcom %} notifies repository maintainers when security researchers privately report vulnerabilities in their repository, and sends notifications if maintainers watch the repository or if they have notifications enabled for the repository. For more information, see "[Configuring notifications](/account-and-profile/managing-subscriptions-and-notifications-on-github/setting-up-notifications/configuring-notifications)."
{% data reusables.repositories.navigate-to-repo %}
{% data reusables.repositories.sidebar-security %}
{% data reusables.repositories.sidebar-advisories %}
1. Click the advisory you want to review. An advisory that is privately reported will have a status of `Needs triage`.
![Screenshot showing an example of advisory list](/assets/images/help/security/advisory-list.png)
2. Carefully review the report. You can:
- Collaborate with the security researcher on a patch in private, by clicking **Start a temporary private fork**. This gives you a place for further discussions with the contributor without changing the status of the proposed advisory from `Needs triage`.
- Accept the vulnerability report as a draft advisory on {% data variables.product.prodname_dotcom %}, by clicking **Accept and open as draft**. If you choose this option:
- This doesn't make the report public.
- The report becomes a draft repository security advisory and you can work on it in the same way as any draft advisory that you create.
For more information on security advisories, see "[About repository security advisories](/code-security/security-advisories/repository-security-advisories/about-repository-security-advisories)."
- Reject the report by clicking **Close security advisory**. Where possible, you should add a comment explaining why you don't consider the report a security risk before you close the advisory.
![Screenshot showing the options available to the repository maintainer when reviewing an externally submitted vulnerability report](/assets/images/help/security/advisory-maintainer-options.png)

View File

@@ -1,6 +1,6 @@
---
title: Configuring dependency review
intro: You can use dependency review to catch vulnerabilities before they are added to your project.
title: 配置依赖项审查
intro: 可以使用依赖项评审来捕获漏洞,以避免将其添加到项目中。
miniTocMaxHeadingLevel: 3
shortTitle: Configure dependency review
versions:
@@ -15,80 +15,71 @@ topics:
- Vulnerabilities
- Dependencies
- Pull requests
ms.openlocfilehash: b5e5ccb5107cd96d1a88f896fd46d5b948a365cd
ms.sourcegitcommit: c2aa10a61db44ee111c09565b6114dd5c97b6e2e
ms.translationtype: HT
ms.contentlocale: zh-CN
ms.lasthandoff: 11/14/2022
ms.locfileid: '148163350'
---
## About dependency review
## 关于依赖项评审
{% data reusables.dependency-review.feature-overview %}
For more information, see "[About dependency review](/code-security/supply-chain-security/understanding-your-software-supply-chain/about-dependency-review)" and "[Reviewing dependency changes in a pull request](/pull-requests/collaborating-with-pull-requests/reviewing-changes-in-pull-requests/reviewing-dependency-changes-in-a-pull-request)."
有关详细信息,请参阅“[关于依赖项审查](/code-security/supply-chain-security/understanding-your-software-supply-chain/about-dependency-review)”和“[审查拉取请求中的依赖项更改](/pull-requests/collaborating-with-pull-requests/reviewing-changes-in-pull-requests/reviewing-dependency-changes-in-a-pull-request)”。
## About configuring dependency review
## 关于配置依赖项审查
{% ifversion fpt %}
Dependency review is available in all public repositories in all products and cannot be disabled. Dependency review is available in private repositories owned by organizations that use GitHub Enterprise Cloud and have a license for [{% data variables.product.prodname_GH_advanced_security %}](/get-started/learning-about-github/about-github-advanced-security). For more information, see the [{% data variables.product.prodname_ghe_cloud %} documentation](/enterprise-cloud@latest/code-security/supply-chain-security/understanding-your-software-supply-chain/configuring-dependency-review).
{% ifversion fpt %} 依赖项审查在所有产品的所有公共存储库中都可用,并且无法禁用。 依赖项审查在使用 GitHub Enterprise Cloud 并拥有 [{% data variables.product.prodname_GH_advanced_security %}](/get-started/learning-about-github/about-github-advanced-security) 许可证的组织拥有的专用存储库中可用。 有关详细信息,请参阅 [{% data variables.product.prodname_ghe_cloud %} 文档](/enterprise-cloud@latest/code-security/supply-chain-security/understanding-your-software-supply-chain/configuring-dependency-review)。
{% elsif ghec %}
Dependency review is included in {% data variables.product.product_name %} for public repositories. To use dependency review in private repositories owned by organizations, you must have a license for [{% data variables.product.prodname_GH_advanced_security %}](/get-started/learning-about-github/about-github-advanced-security) and have the dependency graph enabled.
{% elsif ghec %} 依赖项审查包含在公共存储库的 {% data variables.product.product_name %} 中。 若要在组织拥有的专用存储库中使用依赖项审查,必须具有 [{% data variables.product.prodname_GH_advanced_security %}](/get-started/learning-about-github/about-github-advanced-security) 许可证并启用依赖项关系图。
{% data reusables.dependabot.enabling-disabling-dependency-graph-private-repo %}
1. If "{% data variables.product.prodname_GH_advanced_security %}" is not enabled, click **Enable** next to the feature.
![Screenshot of GitHub Advanced Security feature with "Enable" button emphasized](/assets/images/help/security/enable-ghas-private-repo.png)
1. 如果尚未启用“{% data variables.product.prodname_GH_advanced_security %}”,请单击此功能旁边的“启用”。
![GitHub 高级安全功能的屏幕截图,其中突出显示了“启用”按钮](/assets/images/help/security/enable-ghas-private-repo.png)
{% elsif ghes or ghae %}
Dependency review is available when dependency graph is enabled for {% data variables.location.product_location %} and {% data variables.product.prodname_advanced_security %} is enabled for the organization or repository.{% ifversion ghes %} For more information, see "[Enabling {% data variables.product.prodname_GH_advanced_security %} for your enterprise](/admin/code-security/managing-github-advanced-security-for-your-enterprise/enabling-github-advanced-security-for-your-enterprise)."{% endif %}
{% data variables.location.product_location %} 启用依赖项关系图并且为组织或存储库启用 {% data variables.product.prodname_advanced_security %} 时,依赖项审查可用。{% ifversion ghes %} 有关详细信息,请参阅“[为企业启用 {% data variables.product.prodname_GH_advanced_security %}](/admin/code-security/managing-github-advanced-security-for-your-enterprise/enabling-github-advanced-security-for-your-enterprise)”。{% endif %}
### Checking if the dependency graph is enabled
### 检查是否已启用依赖项关系图
{% data reusables.repositories.navigate-to-repo %}
{% data reusables.repositories.sidebar-settings %}
{% data reusables.repositories.navigate-to-code-security-and-analysis %}
1. Under "Configure security and analysis features", check if the dependency graph is enabled.
1. If dependency graph is enabled, click **Enable** next to "{% data variables.product.prodname_GH_advanced_security %}" to enable {% data variables.product.prodname_advanced_security %}, including dependency review. The enable button is disabled if your enterprise has no available licenses for {% data variables.product.prodname_advanced_security %}.{% ifversion ghes %}
![Screenshot of "Code security and analysis" features"](/assets/images/enterprise/3.4/repository/code-security-and-analysis-enable-ghas-3.4.png){% endif %}
{% data reusables.repositories.navigate-to-repo %} {% data reusables.repositories.sidebar-settings %} {% data reusables.repositories.navigate-to-code-security-and-analysis %}
1. 在“配置安全性和分析功能”下,检查是否启用了依赖项关系图。
1. 如果已启用依赖项关系图,请单击“{% data variables.product.prodname_GH_advanced_security %}”旁边的“启用”以启用 {% data variables.product.prodname_advanced_security %},其中包含了依赖项审查。 如果企业没有可用的 {% data variables.product.prodname_advanced_security %} 许可证,“启用”按钮会禁用。{% ifversion ghes %} ![“代码安全性和分析”功能的屏幕截图](/assets/images/enterprise/3.4/repository/code-security-and-analysis-enable-ghas-3.4.png){% endif %}
{% endif %}
{% ifversion dependency-review-action-configuration %}
## About configuring the {% data variables.product.prodname_dependency_review_action %}
## 关于配置 {% data variables.product.prodname_dependency_review_action %}
{% data reusables.dependency-review.dependency-review-action-overview %}
The following configuration options are available.
可用配置选项如下。
| Option | Required | Usage |
| 选项 | 必选 | 使用情况 |
|------------------|-------------------------------|--------|
| `fail-on-severity` | Optional | Defines the threshold for level of severity (`low`, `moderate`, `high`, `critical`).</br>The action will fail on any pull requests that introduce vulnerabilities of the specified severity level or higher. |
{%- ifversion dependency-review-action-licenses %}
| `allow-licenses` | Optional | Contains a list of allowed licenses. You can find the possible values for this parameter in the [Licenses](/rest/licenses) page of the API documentation.</br>The action will fail on pull requests that introduce dependencies with licenses that do not match the list.|{% endif %}
{%- ifversion dependency-review-action-licenses %}
| `deny-licenses` | Optional | Contains a list of prohibited licenses. You can find the possible values for this parameter in the [Licenses](/rest/licenses) page of the API documentation.</br>The action will fail on pull requests that introduce dependencies with licenses that match the list.|{% endif %}{% ifversion dependency-review-action-fail-on-scopes %}
| `fail-on-scopes` | Optional | Contains a list of strings representing the build environments you want to support (`development`, `runtime`, `unknown`). </br>The action will fail on pull requests that introduce vulnerabilites in the scopes that match the list.|{% endif %}
| `allow-ghsas` | Optional | Contains a list of {% data variables.product.prodname_advisory_database %} IDs that can be skipped during detection. You can find the possible values for this parameter in the [{% data variables.product.prodname_advisory_database %}](https://github.com/advisories). |
| `config-file` | Optional | Specifies a path to a configuration file. The configuration file can be local to the repository or a file located in an external repository.|
| `external-repo-token` | Optional | Specifies a token for fetching the configuration file, if the file resides in a private external repository. The token must have read access to the repository.|
| `fail-on-severity` | 可选 | 定义严重性级别(`low``moderate``high``critical`)的阈值。</br>对于引入指定严重性级别或更高级别的漏洞的任何拉取请求,该操作都将失败。 |
{%- ifversion dependency-review-action-licenses %} | `allow-licenses` | 可选 | 包含允许的许可证列表。 可以在 API 文档的[许可证](/rest/licenses)页中找到此参数可能的值。</br>如果拉取请求引入许可证与列表不匹配的依赖项,该操作将失败。|{% endif %} {%- ifversion dependency-review-action-licenses %} | `deny-licenses` | 可选 | 包含禁止的许可证列表。 可以在 API 文档的[许可证](/rest/licenses)页中找到此参数可能的值。</br>如果拉取请求引入了具有与列表匹配的许可证的依赖项,该操作将失败。|{% endif %}{% ifversion dependency-review-action-fail-on-scopes %} | `fail-on-scopes` | 可选 | 包含表示要支持的生成环境的字符串列表(`development``runtime``unknown`)。 </br>对于在与列表匹配的范围内引入漏洞的拉取请求,该操作将失败。|{% endif %} | `allow-ghsas` | 可选 | 包含检测过程中可以跳过的 {% data variables.product.prodname_advisory_database %} ID 列表。 可以在 [{% data variables.product.prodname_advisory_database %}](https://github.com/advisories) 中找到此参数的可能值。 | | `config-file` | 可选 | 指定配置文件的路径。 配置文件可以是存储库的本地文件,也可以是位于外部存储库的文件。| | `external-repo-token` | 可选 | 如果文件驻留在专用外部存储库中,则指定用于提取配置文件的令牌。 令牌必须具有该存储库的读取权限。|
{% ifversion dependency-review-action-licenses %}
{% tip %}
{% ifversion dependency-review-action-licenses %} {% tip %}
**Tip:** The `allow-licenses` and `deny-licenses` options are mutually exclusive.
提示:`allow-licenses` `deny-licenses` 选项互斥。
{% endtip %}
{% endif %}
{% endtip %} {% endif %}
## Configuring the {% data variables.product.prodname_dependency_review_action %}
## 配置 {% data variables.product.prodname_dependency_review_action %}
There are two methods of configuring the {% data variables.product.prodname_dependency_review_action %}:
- Inlining the configuration options in your workflow file.
- Referencing a configuration file in your workflow file.
可以通过两种方法配置 {% data variables.product.prodname_dependency_review_action %}
- 在工作流文件中内联配置选项。
- 在工作流文件中引用配置文件。
Notice that all of the examples use a short version number for the action (`v3`) instead of a semver release number (for example, `v3.0.8`). This ensures that you use the most recent minor version of the action.
### Using inline configuration to set up the {% data variables.product.prodname_dependency_review_action %}
请注意,所有示例使用操作 (`v3`) 的短版本号,而不是 semver 版本号(例如,`v3.0.8`)。 这可确保使用操作的最新次要版本。
### 使用内联配置设置 {% data variables.product.prodname_dependency_review_action %}
1. Add a new YAML workflow to your `.github/workflows` folder.
1. 将新的 YAML 工作流添加到 `.github/workflows` 文件夹。
{% ifversion ghes %}For `runs-on`, the default label is `self-hosted`. You can replace the default label with the label of any of your runners.{% endif %}
{% ifversion ghes %}对于 `runs-on`,默认标签为 `self-hosted`。 可以将默认标签替换为任何运行器的标签。{% endif %}
```yaml{:copy}
name: 'Dependency Review'
on: [pull_request]
@@ -106,9 +97,9 @@ Notice that all of the examples use a short version number for the action (`v3`)
- name: Dependency Review
uses: actions/dependency-review-action@v3
```
1. Specify your settings.
1. 指定您的设置。
This {% data variables.product.prodname_dependency_review_action %} example file illustrates how you can use the available configuration options.
{% data variables.product.prodname_dependency_review_action %} 示例文件说明了如何使用可用的配置选项。
```yaml{:copy}
name: 'Dependency Review'
on: [pull_request]
@@ -146,11 +137,11 @@ Notice that all of the examples use a short version number for the action (`v3`)
fail-on-scopes: development, runtime
{% endif %}
```
### Using a configuration file to set up {% data variables.product.prodname_dependency_review_action %}
### 使用配置文件设置 {% data variables.product.prodname_dependency_review_action %}
1. Add a new YAML workflow to your `.github/workflows` folder and use `config-file` to specify that you are using a configuration file.
1. 将新的 YAML 工作流添加到 `.github/workflows` 文件夹,并使用 `config-file` 指定正在使用配置文件。
{% ifversion ghes %}For `runs-on`, the default label is `self-hosted`. You can replace the default label with the label of any of your runners.{% endif %}
{% ifversion ghes %}对于 `runs-on`,默认标签为 `self-hosted`。 可以将默认标签替换为任何运行器的标签。{% endif %}
```yaml{:copy}
name: 'Dependency Review'
on: [pull_request]
@@ -178,9 +169,9 @@ Notice that all of the examples use a short version number for the action (`v3`)
# Possible values: Any GitHub token with read access to the private external repository.
external-repo-token: 'ghp_123456789abcde'
```
1. Create the configuration file in the path you have specified.
1. 在指定路径中创建配置文件。
This YAML example file illustrates how you can use the available configuration options.
YAML 示例文件说明了如何使用可用的配置选项。
```yaml{:copy}
# Possible values: "critical", "high", "moderate", "low"
fail-on-severity: critical
@@ -211,5 +202,5 @@ Notice that all of the examples use a short version number for the action (`v3`)
- runtime
{% endif %}
```
For further details about the configuration options, see [`dependency-review-action`](https://github.com/actions/dependency-review-action#readme).
有关配置选项的更多详细信息,请参阅 [`dependency-review-action`](https://github.com/actions/dependency-review-action#readme)
{% endif %}

View File

@@ -1,6 +1,6 @@
---
title: Disaster recovery for GitHub Codespaces
intro: 'This article describes guidance for a disaster recovery scenario, when a whole region experiences an outage due to major natural disaster or widespread service interruption.'
title: GitHub Codespaces 的灾难恢复
intro: 本文描述了当整个地区因重大自然灾害或大范围服务中断而中断时,灾难恢复情景的指导。
versions:
fpt: '*'
ghec: '*'
@@ -9,44 +9,49 @@ topics:
shortTitle: Disaster recovery
redirect_from:
- /codespaces/codespaces-reference/disaster-recovery-for-codespaces
ms.openlocfilehash: 9b892d6a24332e01174c819e2e88a91d1cdf9d65
ms.sourcegitcommit: e8c012864f13f9146e53fcb0699e2928c949ffa8
ms.translationtype: HT
ms.contentlocale: zh-CN
ms.lasthandoff: 11/09/2022
ms.locfileid: '148158811'
---
我们努力确保你始终能够使用 {% data variables.product.prodname_github_codespaces %}。 但是,超出我们控制范围的力量有时会以导致计划外服务中断的方式影响服务。
We work hard to make sure that {% data variables.product.prodname_github_codespaces %} is always available to you. However, forces beyond our control sometimes impact the service in ways that can cause unplanned service disruptions.
虽然灾难恢复情况很少发生,但我们建议您为整个区域出现中断的可能性做好准备。 如果整个区域遇到服务中断,则数据的本地冗余副本将暂时不可用。
Although disaster recovery scenarios are rare occurrences, we recommend that you prepare for the possibility that there is an outage of an entire region. If an entire region experiences a service disruption, the locally redundant copies of your data would be temporarily unavailable.
The following guidance provides options on how to handle service disruption to the entire region where your codespace is deployed.
以下指南提供了如何处理部署代码空间的整个区域的服务中断的选项。
{% note %}
**Note:** You can reduce the potential impact of service-wide outages by pushing to remote repositories frequently.
注意:可以通过频繁推送到远程存储库来减少服务中断的潜在影响。
{% endnote %}
## Option 1: Create a new codespace in another region
## 选项 1在另一个区域中创建新的代码空间
In the case of a regional outage, we suggest you recreate your codespace in an unaffected region to continue working. This new codespace will have all of the changes as of your last push to {% data variables.product.prodname_dotcom %}. For information on manually setting another region, see "[Setting your default region for {% data variables.product.prodname_github_codespaces %}](/codespaces/customizing-your-codespace/setting-your-default-region-for-github-codespaces)."
如果发生区域性断电,我们建议您在未受影响的区域中重新创建代码空间以继续工作。 此新代码将包含您上次推送到 {% data variables.product.prodname_dotcom %} 后的所有更改。 有关手动设置另一个区域的信息,请参阅“[ {% data variables.product.prodname_github_codespaces %} 设置默认区域](/codespaces/customizing-your-codespace/setting-your-default-region-for-github-codespaces)”。
You can optimize recovery time by configuring a `devcontainer.json` in the project's repository, which allows you to define the tools, runtimes, frameworks, editor settings, extensions, and other configuration necessary to restore the development environment automatically. For more information, see "[Introduction to dev containers](/codespaces/setting-up-your-codespace/configuring-codespaces-for-your-project)."
你可以通过在项目存储库中配置 `devcontainer.json` 来优化恢复时间,这样可定义工具、运行时间、框架、编辑器设置、扩展以及其他自动恢复开发环境所需的配置。 有关详细信息,请参阅“[开发容器简介](/codespaces/setting-up-your-codespace/configuring-codespaces-for-your-project)”。
## Option 2: Wait for recovery
## 选项 2等待恢复
In this case, no action on your part is required. Know that we are working diligently to restore service availability.
在此情况下,不需要采取任何操作。 但要知道,我们正在努力还原服务的可用性。
You can check the current service status on the [Status Dashboard](https://www.githubstatus.com/).
你可以在[状态仪表板](https://www.githubstatus.com/)上查看当前服务状态。
## Option 3: Clone the repository locally or edit in the browser
## 选项 3本地克隆存储库或在浏览器中编辑
While {% data variables.product.prodname_github_codespaces %} provides the benefit of a pre-configured developer environmnent, your source code should always be accessible through the repository hosted on {% data variables.product.prodname_dotcom_the_website %}. In the event of a {% data variables.product.prodname_github_codespaces %} outage, you can still clone the repository locally or edit files in the {% data variables.product.company_short %} browser editor. For more information, see "[Editing files](/repositories/working-with-files/managing-files/editing-files)."
虽然 {% data variables.product.prodname_github_codespaces %} 具有预配置的开发者环境的优点,但源代码应该始终可以通过 {% data variables.product.prodname_dotcom_the_website %} 托管的存储库访问。 如果发生 {% data variables.product.prodname_github_codespaces %} 中断,仍然可以本地克隆存储库或在 {% data variables.product.company_short %} 浏览器编辑器中编辑文件。 有关详细信息,请参阅“[编辑文件](/repositories/working-with-files/managing-files/editing-files)”。
While this option does not configure a development environment for you, it will allow you to make changes to your source code as needed while you wait for the service disruption to resolve.
虽然此选项没有为您配置开发环境, 但它允许您在等待服务中断解决时根据需要更改源代码。
## Option 4: Use the Dev Containers extension and Docker for a local containerized environment
## 选项 4对本地容器化环境使用开发容器扩展和 Docker
If your repository has a `devcontainer.json`, consider using the [Dev Containers extension](https://marketplace.visualstudio.com/items?itemName=ms-vscode-remote.remote-containers) in {% data variables.product.prodname_vscode %} to build and attach to a local development container for your repository. The setup time for this option will vary depending on your local specifications and the complexity of your dev container setup. For more information, see "[Developing inside a container](https://code.visualstudio.com/docs/remote/containers#_quick-start-open-a-git-repository-or-github-pr-in-an-isolated-container-volume)" in the {% data variables.product.prodname_vscode_shortname %} documentation.
如果存储库具有 `devcontainer.json`,请考虑在 {% data variables.product.prodname_vscode %} 中使用[开发容器扩展](https://marketplace.visualstudio.com/items?itemName=ms-vscode-remote.remote-containers)构建并连接到存储库的本地开发容器。 此选项的设置时间将因您本地规格和开发容器设置的复杂性而异。 有关详细信息,请参阅 {% data variables.product.prodname_vscode_shortname %} 文档中的“[在容器中开发](https://code.visualstudio.com/docs/remote/containers#_quick-start-open-a-git-repository-or-github-pr-in-an-isolated-container-volume)”。
{% note %}
**Note:** Be sure your local setup meets the [minimum requirements](https://code.visualstudio.com/docs/remote/containers#_system-requirements) before attempting this option.
注意:在尝试使用此选项之前,请确保本地设置满足[最低要求](https://code.visualstudio.com/docs/remote/containers#_system-requirements)
{% endnote %}

View File

@@ -10,6 +10,7 @@ children:
- /using-the-github-codespaces-plugin-for-jetbrains
- /using-the-vs-code-command-palette-in-codespaces
- /security-in-github-codespaces
- /performing-a-full-rebuild-of-a-container
- /disaster-recovery-for-github-codespaces
ms.openlocfilehash: 87692cd862e791f3e6ffa2be2b07f34c6158e617
ms.sourcegitcommit: e8c012864f13f9146e53fcb0699e2928c949ffa8

View File

@@ -1,6 +1,6 @@
---
title: Using GitHub Copilot in GitHub Codespaces
intro: 'You can use {% data variables.product.prodname_copilot %} in {% data variables.product.prodname_github_codespaces %} by adding the extension.'
title: GitHub Codespaces 中使用 GitHub Copilot
intro: '可以通过添加扩展在 {% data variables.product.prodname_github_codespaces %} 中使用 {% data variables.product.prodname_copilot %}。'
versions:
fpt: '*'
ghec: '*'
@@ -13,8 +13,13 @@ shortTitle: Copilot in Codespaces
redirect_from:
- /codespaces/codespaces-reference/using-copilot-in-codespaces
- /codespaces/codespaces-reference/using-github-copilot-in-codespaces
ms.openlocfilehash: 6615df6930fa8f27dd8f50c4588d8182b8602549
ms.sourcegitcommit: e8c012864f13f9146e53fcb0699e2928c949ffa8
ms.translationtype: HT
ms.contentlocale: zh-CN
ms.lasthandoff: 11/09/2022
ms.locfileid: '148158723'
---
{% jetbrains %}
{% data reusables.codespaces.codespaces-jetbrains-beta-note %}
@@ -23,7 +28,7 @@ redirect_from:
{% webui %}
## Using {% data variables.product.prodname_copilot %} in the {% data variables.product.prodname_vscode_shortname %} web client
## {% data variables.product.prodname_vscode_shortname %} Web 客户端中使用 {% data variables.product.prodname_copilot %}
{% data reusables.codespaces.copilot-in-vscode %}
@@ -31,7 +36,7 @@ redirect_from:
{% vscode %}
## Using {% data variables.product.prodname_copilot %} in {% data variables.product.prodname_vscode %}
## {% data variables.product.prodname_vscode %} 中使用 {% data variables.product.prodname_copilot %}
{% data reusables.codespaces.copilot-in-vscode %}
@@ -39,57 +44,57 @@ redirect_from:
{% jetbrains %}
## Installing {% data variables.product.prodname_copilot %} in your JetBrains IDE
## 在 JetBrains IDE 中安装 {% data variables.product.prodname_copilot %}
[{% data variables.product.prodname_copilot %}](https://copilot.github.com/), an AI pair programmer, can be used in any codespace. For more information, see "[About GitHub Copilot](/copilot/overview-of-github-copilot/about-github-copilot)."
[{% data variables.product.prodname_copilot %}](https://copilot.github.com/) 是 AI 结对程序员,可用于任何 codespace。 有关详细信息,请参阅“[关于 GitHub Copilot](/copilot/overview-of-github-copilot/about-github-copilot)”。
To use {% data variables.product.prodname_copilot %} in a codespace in your JetBrains IDE, install the [{% data variables.product.prodname_copilot %} plugin](https://plugins.jetbrains.com/plugin/17718-github-copilot) from within your codespace.
若要在 JetBrains IDE 的 codespace 中使用 {% data variables.product.prodname_copilot %},请在 codespace 中安装 [{% data variables.product.prodname_copilot %} 插件](https://plugins.jetbrains.com/plugin/17718-github-copilot)
{% note %}
**Note**: You must install the {% data variables.product.prodname_copilot %} plugin each time you create a new codespace.
注意:每次创建新 codespace 时,都必须安装 {% data variables.product.prodname_copilot %} 插件。
{% endnote %}
1. In the JetBrains client application, open the Settings (Windows/Linux) or Preferences (Mac) dialog box:
1. JetBrains 客户端应用程序中,打开“设置”(Windows/Linux) 或“首选项”(Mac) 对话框:
- **Windows/Linux**: Click **File** and then **Settings** (or press <kbd>Ctrl</kbd>+<kbd>Alt</kbd>+<kbd>S</kbd>)
- **Mac**: Click **JetBrains Client** in the MacOS menu bar, then click **Preferences** (or press <kbd>command</kbd>+<kbd>,</kbd>)
- **Windows/Linux**:单击“文件”,然后单击“设置”(或按<kbd>Ctrl</kbd>+<kbd>Alt</kbd>+<kbd>S</kbd>
- **Mac**:在 MacOS 菜单栏中单击“JetBrains 客户端”“首选项”(或按<kbd>command</kbd>+<kbd>,</kbd>
1. In the left-side menu of the Settings/Preferences dialog box, click **Plugins On Host**. Then click the **Marketplace** tab.
1. 在“设置/首选项”对话框的左侧菜单中,单击“主机上的插件”。 然后单击“市场”选项卡。
![Screenshot of the Marketplace tab for 'Plugins On Host'](/assets/images/help/codespaces/jetbrains-preferences-plugins.png)
![“主机上的插件”的“市场”选项卡的屏幕截图](/assets/images/help/codespaces/jetbrains-preferences-plugins.png)
1. In the search box, type "copilot" then click the **Install** button for the {% data variables.product.prodname_copilot %} plugin.
1. 在搜索框中键入“copilot”然后单击 {% data variables.product.prodname_copilot %} 插件的“安装”按钮。
![Screenshot of the {% data variables.product.prodname_copilot %} plugin](/assets/images/help/codespaces/jetbrains-copilot-plugin.png)
![{% data variables.product.prodname_copilot %} 插件的屏幕截图](/assets/images/help/codespaces/jetbrains-copilot-plugin.png)
1. Click **Accept** on the "Third-Party Plugins Privacy Note" dialog box.
1. Click **Restart IDE**.
1. 在“第三方插件隐私说明”对话框中单击“接受”。
1. 单击“重启 IDE”。
![Screenshot of the {% data variables.product.prodname_copilot %} plugin](/assets/images/help/codespaces/jetbrains-copilot-restart.png)
![{% data variables.product.prodname_copilot %} 插件的屏幕截图](/assets/images/help/codespaces/jetbrains-copilot-restart.png)
1. Click **Restart** when prompted to confirm that you want to restart the backend IDE that's running remotely. The JetBrains client application will close when you do this.
1. Open the codespace again from the JetBrains Gateway application. For more information, see "[Using {% data variables.product.prodname_github_codespaces %} in your JetBrains IDE](/codespaces/developing-in-codespaces/using-github-codespaces-in-your-jetbrains-ide#opening-a-codespace-in-your-jetbrains-ide)."
1. After your JetBrains IDE has restarted, click the **Tools** menu. Click **{% data variables.product.prodname_copilot %}**, then click **Login to {% data variables.product.prodname_dotcom %}**.
1. 当提示确认是否要重启远程运行的后端 IDE 时,单击“重启”。 单击重启后JetBrains 客户端应用程序将关闭。
1. 再次从 JetBrains 网关应用程序打开 codespace。 有关详细信息,请参阅“[在 JetBrains IDE 中使用 {% data variables.product.prodname_github_codespaces %}](/codespaces/developing-in-codespaces/using-github-codespaces-in-your-jetbrains-ide#opening-a-codespace-in-your-jetbrains-ide)”。
1. JetBrains IDE 重启后,单击“工具”菜单。 单击“{% data variables.product.prodname_copilot %}”,然后单击“登录到 {% data variables.product.prodname_dotcom %}”。
![Screenshot of the JetBrains Tools menu](/assets/images/help/codespaces/jetbrains-tools-menu.png)
![JetBrains 工具菜单的屏幕截图](/assets/images/help/codespaces/jetbrains-tools-menu.png)
1. In the "Sign in to {% data variables.product.prodname_dotcom %}" dialog box, to copy the device code and open the device activation window, click **Copy and Open**.
1. 在“登录到 {% data variables.product.prodname_dotcom %}”对话框中,若要复制设备代码并打开设备激活窗口,请单击“复制并打开”。
![Screenshot of the device code copy and open](/assets/images/help/copilot/device-code-copy-and-open.png)
![设备代码复制和打开的屏幕截图](/assets/images/help/copilot/device-code-copy-and-open.png)
1. A device activation window will open in your browser. Paste the device code, then click **Continue**.
1. 设备激活窗口将在浏览器中打开。 粘贴设备代码,然后单击“继续”。
- To paste the code in Windows or Linux, press <kbd>Ctrl</kbd>+<kbd>v</kbd>.
- To paste the code in macOS, press <kbd>command</kbd>+<kbd>v</kbd>.
1. {% data variables.product.prodname_dotcom %} will request the necessary permissions for {% data variables.product.prodname_copilot %}. To approve these permissions, click **Authorize {% data variables.product.prodname_copilot %} Plugin**.
1. After the permissions have been approved, your JetBrains IDE will show a confirmation. To begin using {% data variables.product.prodname_copilot %}, click **OK**.
- 若要在 Windows Linux 中粘贴代码,请按 <kbd>Ctrl</kbd>+<kbd>v</kbd>
- 若要在 macOS 中粘贴代码,请按 <kbd>command</kbd>+<kbd>v</kbd>
1. {% data variables.product.prodname_dotcom %} 将请求 {% data variables.product.prodname_copilot %} 所需的权限。 若要批准这些权限,请单击“授权 {% data variables.product.prodname_copilot %} 插件”。
1. 权限获得批准后JetBrains IDE 将显示确认。 要开始使用 {% data variables.product.prodname_copilot %},请单击“确定”。
![Screenshot of the JetBrains IDE permissions confirmation](/assets/images/help/copilot/jetbrains-ide-confirmation.png)
![JetBrains IDE 权限确认的屏幕截图](/assets/images/help/copilot/jetbrains-ide-confirmation.png)
## Further reading
## 延伸阅读
- "[Getting started with GitHub Copilot in a JetBrains IDE](/copilot/getting-started-with-github-copilot/getting-started-with-github-copilot-in-a-jetbrains-ide)"
- [在 JetBrains IDE 中开始使用 GitHub Copilot](/copilot/getting-started-with-github-copilot/getting-started-with-github-copilot-in-a-jetbrains-ide)
{% endjetbrains %}
{% endjetbrains %}

View File

@@ -0,0 +1,72 @@
---
title: 使用适用于 JetBrains 的 GitHub Codespaces 插件
shortTitle: Plugin for JetBrains
intro: '可以使用 JetBrains 客户端应用程序的 {% data variables.product.prodname_github_codespaces %} 插件来了解 codespace 或在完成工作后停止 codespace。'
versions:
fpt: '*'
ghec: '*'
type: reference
topics:
- Codespaces
ms.openlocfilehash: 8ffd48856a2653f3db3c871122d3acd23c246d7a
ms.sourcegitcommit: e8c012864f13f9146e53fcb0699e2928c949ffa8
ms.translationtype: HT
ms.contentlocale: zh-CN
ms.lasthandoff: 11/09/2022
ms.locfileid: '148159444'
---
{% data reusables.codespaces.codespaces-jetbrains-beta-note %}
## 关于 {% data variables.product.prodname_github_codespaces %} 插件
从 JetBrains 网关应用程序连接到 codespace 时,将启动 JetBrains 客户端应用程序。 它允许你将 {% data variables.product.prodname_github_codespaces %} 与你最喜爱的 JetBrains IDE 一起使用。 有关详细信息,请参阅“[在 JetBrains IDE 中使用 {% data variables.product.prodname_github_codespaces %}](/codespaces/developing-in-codespaces/using-github-codespaces-in-your-jetbrains-ide)”。
从 JetBrains 网关连接到 codespace 时,{% data variables.product.prodname_github_codespaces %} 插件已安装在 JetBrains 客户端中。 插件将 {% data variables.product.prodname_github_codespaces %} 工具窗口添加到用户界面。
单击 JetBrains 客户端应用程序窗口左下角的“{% data variables.product.prodname_github_codespaces %}”以打开 {% data variables.product.prodname_github_codespaces %} 工具窗口。
![{% data variables.product.prodname_github_codespaces %} 工具窗口的屏幕截图](/assets/images/help/codespaces/jetbrains-codespaces-tool-window.png)
## 使用 {% data variables.product.prodname_github_codespaces %} 工具窗口
{% data variables.product.prodname_github_codespaces %} 工具窗口显示:
* 从中创建此 codespace 的存储库。
* codespace 的显示名称。
* 当前分支。
* 计算机规格。
* 此 codespace 在自动停止之前可以保持空闲的时间。
* codespace 的使用期限。
* 停止的 codespace 在自动删除之前将保留的时间段。
{% data variables.product.prodname_github_codespaces %} 工具窗口顶部的图标提供以下功能。
* **刷新活动 codespace**
![“刷新”按钮的屏幕截图](/assets/images/help/codespaces/jetbrains-plugin-icon-refresh-BAK.png)
刷新 {% data variables.product.prodname_github_codespaces %} 工具窗口中的详细信息。 例如,如果使用了 {% data variables.product.prodname_cli %} 更改显示名称,则可以单击此按钮以显示新名称。
* **断开连接并停止**
![“停止”按钮的屏幕截图](/assets/images/help/codespaces/jetbrains-plugin-icon-stop.png)
停止 codespace停止远程计算机上的后端 IDE然后关闭本地 JetBrains 客户端。
* **从 Web 管理 codespace**
![“列表”按钮的屏幕截图](/assets/images/help/codespaces/jetbrains-plugin-icon-index.png)
在 https://github.com/codespaces 打开 codespace 列表。
* **查看 codespace 创建日志**
![“日志”按钮的屏幕截图](/assets/images/help/codespaces/jetbrains-plugin-icon-log.png)
在编辑器窗口中打开 codespace 创建日志。 有关详细信息,请参阅“[{% data variables.product.prodname_github_codespaces %} 日志](/codespaces/troubleshooting/github-codespaces-logs)”。
* **重新生成开发容器**
![“重新生成”按钮的屏幕截图](/assets/images/help/codespaces/jetbrains-plugin-icon-rebuild.png)
重新生成 codespace 以应用对开发容器配置所做的更改。 JetBrains 客户端将关闭,必须重新打开 codespace。 有关详细信息,请参阅“[codespace 生命周期](/codespaces/developing-in-codespaces/the-codespace-lifecycle#rebuilding-a-codespace)”。

View File

@@ -58,6 +58,8 @@ To rebuild your container, [access the {% data variables.product.prodname_vscode
![Command to rebuild a codespace](/assets/images/help/codespaces/codespaces-rebuild.png)
{% data reusables.codespaces.full-rebuild-tip %}
### Codespaces logs
You can use the {% data variables.product.prodname_vscode_command_palette_shortname %} to access the codespace creation logs, or you can use it export all logs.

View File

@@ -1,7 +1,7 @@
---
title: Changing the machine type for your codespace
title: 更改代码空间的计算机类型
shortTitle: Change the machine type
intro: 'You can change the type of machine that''s running your codespace, so that you''re using resources appropriate for the work you''re doing.'
intro: 可更改运行 codespace 的计算机类型,以便使用适合你正在执行的工作的资源。
versions:
fpt: '*'
ghec: '*'
@@ -10,21 +10,26 @@ redirect_from:
topics:
- Codespaces
type: how_to
ms.openlocfilehash: b8614e9389aa617b3bfcfa3444f5a60aa7dd3c2e
ms.sourcegitcommit: e8c012864f13f9146e53fcb0699e2928c949ffa8
ms.translationtype: HT
ms.contentlocale: zh-CN
ms.lasthandoff: 11/09/2022
ms.locfileid: '148159083'
---
## 关于机器类型
## About machine types
{% data reusables.codespaces.codespaces-machine-types %} 可以在创建 codespace 时或创建 codespace 后的任何时间选择备用计算机类型。
{% data reusables.codespaces.codespaces-machine-types %} You can choose an alternative machine type either when you create a codespace or at any time after you've created a codespace.
有关在创建 codespace 时选择计算机类型的信息,请参阅“[为存储库创建 codespace](/codespaces/developing-in-codespaces/creating-a-codespace-for-a-repository#creating-a-codespace-for-a-repository)”。
For information on choosing a machine type when you create a codespace, see "[Creating a codespace for a repository](/codespaces/developing-in-codespaces/creating-a-codespace-for-a-repository#creating-a-codespace-for-a-repository)."
{% data reusables.codespaces.machine-types-for-unpublished-codespaces %} 有关详细信息,请参阅“[从模板创建 codespace](/codespaces/developing-in-codespaces/creating-a-codespace-from-a-template)”。
{% data reusables.codespaces.machine-types-for-unpublished-codespaces %} For more information, see "[Creating a codespace from a template](/codespaces/developing-in-codespaces/creating-a-codespace-from-a-template)."
## Changing the machine type
## 更改计算机类型
{% note %}
**Note**: {% data reusables.codespaces.codespaces-machine-type-availability %}
注意:{% data reusables.codespaces.codespaces-machine-type-availability %}
{% endnote %}
@@ -32,18 +37,18 @@ For information on choosing a machine type when you create a codespace, see "[Cr
{% data reusables.codespaces.your-codespaces-procedure-step %}
The current machine type for each of your codespaces is displayed.
将显示每个代码空间的当前计算机类型。
!['Your codespaces' list](/assets/images/help/codespaces/your-codespaces-list.png)
![“您的代码空间”列表](/assets/images/help/codespaces/your-codespaces-list.png)
{% data reusables.codespaces.ellipsis-settings %}
1. Click **Change machine type**.
1. 单击“更改计算机类型”。
!['Change machine type' menu option](/assets/images/help/codespaces/change-machine-type-menu-option.png)
1. If multiple machine types are available for your codespace, choose the type of machine you want to use.
![“更改机器类型”菜单选项](/assets/images/help/codespaces/change-machine-type-menu-option.png)
1. 如果有多个计算机类型可用于代码空间,请选择要使用的计算机类型。
![Dialog box showing available machine types to choose](/assets/images/help/codespaces/change-machine-type-choice.png)
1. Click **Update codespace**.
![显示可供选择的可用计算机类型的对话框](/assets/images/help/codespaces/change-machine-type-choice.png)
1. 单击“更新 codespace”。
{% endwebui %}
@@ -55,39 +60,39 @@ For information on choosing a machine type when you create a codespace, see "[Cr
{% cli %}
You can use the `gh codespace edit --machine MACHINE-TYPE-NAME` {% data variables.product.prodname_cli %} command to change the machine type of a codespace. To use this command, you'll first need to find out the available machine types for your codespace.
可使用 `gh codespace edit --machine MACHINE-TYPE-NAME` {% data variables.product.prodname_cli %} 命令更改 codespace 的计算机类型。 要使用此命令,首先需要了解可用于 codespace 的计算机类型。
1. To view your list of codespaces, in a terminal, enter the following command.
1. 要查看 codespace 列表,请在终端中输入以下命令。
```
gh codespace list
```
1. Optionally, to find the current machine type for a codespace, enter the following command.
1. (可选)要查找 codespace 的当前计算机类型,请输入以下命令。
```
gh api /user/codespaces/CODESPACE-NAME
```
Replace `CODESPACE-NAME` with the permanent name of the codespace, for example `octocat-literate-space-parakeet-mld5`. The permanent names are listed under the **NAME** column in the list returned by `gh codespace list`.
`CODESPACE-NAME` 替换为 codespace 的永久名称,如 `octocat-literate-space-parakeet-mld5`。 永久名称列在 返回的列表中的“名称”列下`gh codespace list`
If you're prompted to request the `codespace` scope, follow the instructions in the terminal.
如果系统提示请求 `codespace` 范围,请按照终端中的说明进行操作。
Details for the current machine are listed under the `machine` field.
1. To find the available machine types for a codespace, enter the following command.
当前计算机的详细信息列在 `machine` 字段下。
1. 要查找可用于 codespace 的计算机类型,请输入以下命令。
```
gh api /user/codespaces/CODESPACE-NAME/machines
```
Replace `CODESPACE-NAME` with the permanent name of the codespace, for example `octocat-literate-space-parakeet-mld5`.
1. To change the machine type for a codespace, enter the following command.
`CODESPACE-NAME` 替换为 codespace 的永久名称,如 `octocat-literate-space-parakeet-mld5`
1. 要更改 codespace 的计算机类型,请输入以下命令。
```
gh codespace edit --machine MACHINE-TYPE-NAME
```
Replace `MACHINE-TYPE-NAME` with the name of an available machine type for your codespace, for example `standardLinux32gb`.
1. Using the arrow keys, navigate to the codespace you want to change, then press <kbd>Enter</kbd>.
`MACHINE-TYPE-NAME` 替换为可用于 codespace 的计算机类型的名称,例如 `standardLinux32gb`
1. 使用箭头键导航到要更改的 codespace然后按 <kbd>Enter</kbd>
{% endcli %}
@@ -95,9 +100,9 @@ You can use the `gh codespace edit --machine MACHINE-TYPE-NAME` {% data variable
{% cli %}
## Further reading
## 延伸阅读
- "[Codespaces machines](/rest/codespaces/machines)" in the REST API documentation
- [`gh codespace edit`](https://cli.github.com/manual/gh_codespace_edit) in the {% data variables.product.prodname_cli %} manual
- REST API 文档中的“[Codespaces 计算机](/rest/codespaces/machines)
- {% data variables.product.prodname_cli %} 手册中的 [`gh codespace edit`](https://cli.github.com/manual/gh_codespace_edit)
{% endcli %}

View File

@@ -1,85 +1,89 @@
---
title: Configuring automatic deletion of your codespaces
title: 配置 codespace 的自动删除
shortTitle: Configure automatic deletion
intro: 'Inactive codespaces are automatically deleted. You can choose how long your stopped codespaces are retained, up to a maximum of 30 days.'
intro: 处于非活动状态的 codespace 会自动删除。 你可以选择停止的 codespace 将保留多长时间,最长为 30 天。
versions:
fpt: '*'
ghec: '*'
topics:
- Codespaces
type: how_to
ms.openlocfilehash: 5414d2223f490638f27475840a25883e9c353e77
ms.sourcegitcommit: e8c012864f13f9146e53fcb0699e2928c949ffa8
ms.translationtype: HT
ms.contentlocale: zh-CN
ms.lasthandoff: 11/09/2022
ms.locfileid: '148159488'
---
默认情况下,{% data variables.product.prodname_github_codespaces %} 在停止且保持 30 天的非活动状态后会自动删除。
By default, {% data variables.product.prodname_github_codespaces %} are automatically deleted after they have been stopped and have remained inactive for 30 days.
However, because {% data variables.product.prodname_github_codespaces %} incurs storage charges, you may prefer to reduce the retention period by changing your default period in your personal settings for {% data variables.product.prodname_github_codespaces %}. For more information about storage charges, see "[About billing for {% data variables.product.prodname_github_codespaces %}](/billing/managing-billing-for-github-codespaces/about-billing-for-github-codespaces#codespaces-pricing)."
但是,由于 {% data variables.product.prodname_github_codespaces %} 会产生存储费用,因此,你可能希望通过在 {% data variables.product.prodname_github_codespaces %} 的个人设置中更改默认期限来减少保持期。 有关存储费用的详细信息,请参阅“[关于 {% data variables.product.prodname_github_codespaces %} 的计费](/billing/managing-billing-for-github-codespaces/about-billing-for-github-codespaces#codespaces-pricing)”。
{% note %}
**Note**: Whether or not you have set a personal codespace retention period, it's a good idea to get into the habit of deleting codespaces that you no longer need. For more information, see "[Deleting a codespace](/codespaces/developing-in-codespaces/deleting-a-codespace)."
注意:无论你是否设置了个人 codespace 保持期,最好养成删除不再需要的 codespace 的习惯。 有关详细信息,请参阅“[删除 codespace](/codespaces/developing-in-codespaces/deleting-a-codespace)”。
{% endnote %}
Automatic deletion happens irrespective of whether a codespace contains unpushed changes. To prevent automatic deletion of a codespace, just open the codespace again. The retention period is reset every time you connect to a codespace, and the retention countdown restarts when the codespace is stopped.
无论 codespace 是否包含未推送的更改,自动删除都会进行。 若要防止 codespace 的自动删除,只需再次打开此 codespace 即可。 每次连接到 codespace 时保持期都会重置,并且当 codespace 停止时,保留倒计时将重新开始。
If a repository belongs to an organization, the organization admin may have set a retention period for the whole organization. If this period is less than the default retention period in your personal settings then the organization retention period will apply to codespaces you create for this repository. For more information, see "[Restricting the retention period for codespaces](/codespaces/managing-codespaces-for-your-organization/restricting-the-retention-period-for-codespaces)."
如果存储库属于某一组织,此组织管理员可能已为整个组织设置了保持期。 如果此期限小于个人设置中的默认保持期,则组织保持期将应用于为此存储库创建的 codespace。 有关详细信息,请参阅“[限制 codespace 的保持期](/codespaces/managing-codespaces-for-your-organization/restricting-the-retention-period-for-codespaces)”。
Each codespace has its own retention period. You may, therefore, have codespaces with different rentention periods. For example, if:
* You created a codespace, changed your default retention period, then created another codespace.
* You created a codespace using {% data variables.product.prodname_cli %} and specified a different retention period.
* You created a codespace from an organization-owned repository that has a retention period configured for the organization.
每个 codespace 都有自身的保持期。 因此,你可能拥有具有不同保持期的 codespace。 例如,如果:
* 你创建了一个 codespace更改了你的默认保持期然后创建了另一个 codespace
* 你使用 {% data variables.product.prodname_cli %} 创建了一个 codespace并指定了一个不同的保持期。
* 你从组织拥有的存储库创建了一个 codespace该存储库拥有为组织配置的保持期。
{% note %}
**Note**: The retention period is specified in days. A day represents a 24-hour period, beginning at the time of day when you stop a codespace.
注意:保持期是按天指定的。 一天表示一个 24 小时的期限,从停止 codespace 那一天的那一刻起。
{% endnote %}
{% webui %}
## Setting a default retention period for your codespaces
## 设置 codespace 的默认保持期
{% data reusables.user-settings.access_settings %}
{% data reusables.user-settings.codespaces-tab %}
1. Under "Default retention period", enter the number of days for which you want your codespaces to be retained, by default, after they have been stopped.
{% data reusables.user-settings.access_settings %} {% data reusables.user-settings.codespaces-tab %}
1. 在“默认保持期”下,输入你希望 codespace 在停止后默认将保留的天数。
![Selecting your retention period](/assets/images/help/codespaces/setting-default-retention.png)
![选择保持期](/assets/images/help/codespaces/setting-default-retention.png)
You can set your default retention period between `0` and `30` days.
你可以在 `0` `30` 天之间设置默认的保持期。
{% warning %}
**Warning**: Setting the period to `0` will result in your codespaces being immediately deleted when you stop them, or when they timeout due to inactivity. For more information, see "[Setting your timeout period for {% data variables.product.prodname_github_codespaces %}](/codespaces/customizing-your-codespace/setting-your-timeout-period-for-github-codespaces)."
警告:将期限设置为 `0` 将导致 codespace 在停止时或由于处于非活动状态而超时时被立即删除。 有关详细信息,请参阅“[设置 {% data variables.product.prodname_github_codespaces %} 的超时时间](/codespaces/customizing-your-codespace/setting-your-timeout-period-for-github-codespaces)”。
{% endwarning %}
1. Click **Save**.
1. 单击“保存” 。
When you create a codespace using {% data variables.product.prodname_cli %} you can override this default. If you create a codespace in an organization that specifies a shorter retention period, the organization-level value overrides your personal setting.
使用 {% data variables.product.prodname_cli %} 创建 codespace 时,可以重写此默认值。 如果在指定了更短保持期的组织中创建 codespace则组织级别的值将重写你的个人设置。
If you set a retention period of more than a day, you'll be sent an email notification one day prior to its deletion.
如果设置的保持期超过一天,你将在删除的前一天收到电子邮件通知。
## Checking the remaining time until autodeletion
## 检查自动删除之前剩余的时间
You can check whether a codespace is due to be automatically deleted soon.
可以查看 codespace 是否即将自动删除。
When an inactive codespace is approaching the end of its retention period, this is indicated in your list of codespaces on {% data variables.product.prodname_dotcom %} at [https://github.com/codespaces](https://github.com/codespaces).
当处于非活动状态的 codespace 的保持期即将结束时,这将在 {% data variables.product.prodname_dotcom %} 上的 codespace 列表中指明:[https://github.com/codespaces](https://github.com/codespaces)
![The pre-deletion message in the codespaces list on {% data variables.product.prodname_dotcom %}](/assets/images/help/codespaces/retention-deletion-message.png)
![{% data variables.product.prodname_dotcom %} 上的 codespace 列表中的预删除消息](/assets/images/help/codespaces/retention-deletion-message.png)
{% endwebui %}
{% cli %}
## Setting a retention period for a codespace
## 设置 codespace 的保持期
To set the codespace retention period when you create a codespace, use the `--retention-period` flag with the `codespace create` subcommand. Specify the period in days. The period must be between 0 and 30 days.
若要在创建 codespace 时设置 codespace 保持期,请将 `--retention-period` 标志与 `codespace create` 子命令一起使用。 按天数指定期限。 期限必须介于 0 到 30 天之间。
```shell
gh codespace create --retention-period DAYS
```
If you don't specify a retention period when you create a codespace, then either your default retention period, or an organization retention period, will be used, depending on which is lower. For information about setting your default retention period, click the "Web browser" tab on this page.
如果在创建 codespace 时未指定保持期,则将使用默认保持期或组织保持期,具体视哪个保持期的期限较低。 有关设置默认保持期的信息请单击此页面上的“Web 浏览器”选项卡。
{% data reusables.cli.cli-learn-more %}
@@ -87,20 +91,20 @@ If you don't specify a retention period when you create a codespace, then either
{% vscode %}
## Setting the retention period
## 指定保持期
You can set your default retention period in your web browser, on {% data variables.product.prodname_dotcom_the_website %}. Alternatively, if you use {% data variables.product.prodname_cli %} to create a codespace you can set a retention period for that particular codespace. For more information, click the appropriate tab above.
可以通过 Web 浏览器在 {% data variables.product.prodname_dotcom_the_website %} 上设置默认保持期。 或者,如果使用 {% data variables.product.prodname_cli %} 创建 codespace则可以为该特定 codespace 设置保持期。 有关详细信息,请单击上面相应的选项卡。
## Checking whether codespaces will be autodeleted soon
## 检查 codespace 是否即将被自动删除
You can check, in the {% data variables.product.prodname_vscode %} desktop application, whether a codespace is due to be automatically deleted soon.
可以在 {% data variables.product.prodname_vscode %} 桌面应用程序中检查 codespace 是否即将自动删除。
{% data reusables.codespaces.click-remote-explorer-icon-vscode %}
1. Choose **{% data variables.product.prodname_github_codespaces %}** from the dropdown menu at the top right of the Remote Explorer, if it is not already selected.
1. Under "GITHUB CODESPACES," position the mouse pointer over the codespace that you're interested in. A pop-up box is displayed showing you information about the codespace.
1. 从“远程资源管理器”右上角的下拉菜单中选择“{% data variables.product.prodname_github_codespaces %}”(如果尚未选择)。
1. 在“GITHUB CODESPACES”下,将鼠标指针放置在你感兴趣的 codespace 上。 随即将显示一个弹出框,其中显示了有关 codespace 的信息。
If the codespace is nearing the end of its retention period, a line is included telling you when the codespace will be deleted.
如果 codespace 即将接近保持期的末尾,则会包含一行,此行将告知你 codespace 将何时被删除。
![Codespace information showing the time until deletion](/assets/images/help/codespaces/vscode-deleting-in-5-days.png)
![显示了删除前剩余时间的 codespace 信息](/assets/images/help/codespaces/vscode-deleting-in-5-days.png)
{% endvscode %}

View File

@@ -1,7 +1,7 @@
---
title: Personalizing GitHub Codespaces for your account
title: 个性化你帐户的 GitHub Codespaces
shortTitle: Personalize your codespaces
intro: 'You can personalize {% data variables.product.prodname_github_codespaces %} by using a `dotfiles` repository on {% data variables.product.product_name %} or by using Settings Sync.'
intro: '你可以通过使用 {% data variables.product.product_name %} 上的 `dotfiles` 存储库或使用“设置同步”来个性化 {% data variables.product.prodname_github_codespaces %}。'
redirect_from:
- /github/developing-online-with-github-codespaces/personalizing-github-codespaces-for-your-account
- /github/developing-online-with-codespaces/personalizing-codespaces-for-your-account
@@ -15,91 +15,94 @@ topics:
- Codespaces
- Set up
- Fundamentals
ms.openlocfilehash: 80b6cd1ee982150c1b3c0a66e1247f6098a97bcb
ms.sourcegitcommit: e8c012864f13f9146e53fcb0699e2928c949ffa8
ms.translationtype: HT
ms.contentlocale: zh-CN
ms.lasthandoff: 11/09/2022
ms.locfileid: '148159769'
---
## 关于个性化 {% data variables.product.prodname_codespaces %}
在使用任何开发环境时,根据您的喜好和工作流程自定义设置和工具是一个重要步骤。 {% data variables.product.prodname_github_codespaces %} 支持两种将 codespace 个性化的主要方法。
## About personalizing {% data variables.product.prodname_codespaces %}
- [设置同步](#settings-sync) - 可以在桌面应用程序与 {% data variables.product.prodname_vscode_shortname %} Web 客户端之间同步 {% data variables.product.prodname_vscode %} 设置。
- [Dotfiles](#dotfiles) - 可以使用 `dotfiles` 存储库指定脚本、shell 首选项和其他配置。
When using any development environment, customizing the settings and tools to your preferences and workflows is an important step. {% data variables.product.prodname_github_codespaces %} allows for two main ways of personalizing your codespaces.
{% data variables.product.prodname_github_codespaces %} 个性化适用于你创建的任何代码空间。
- [Settings Sync](#settings-sync) - You can synchronize your {% data variables.product.prodname_vscode %} settings between the desktop application and the {% data variables.product.prodname_vscode_shortname %} web client.
- [Dotfiles](#dotfiles) You can use a `dotfiles` repository to specify scripts, shell preferences, and other configurations.
项目维护员还可以定义默认配置,将应用到任何人创建的仓库的每个代码空间。 有关详细信息,请参阅“[开发容器简介](/codespaces/setting-up-your-project-for-codespaces/introduction-to-dev-containers)”。
{% data variables.product.prodname_github_codespaces %} personalization applies to any codespace you create.
## 设置同步
Project maintainers can also define a default configuration that applies to every codespace for a repository, created by anyone. For more information, see "[Introduction to dev containers](/codespaces/setting-up-your-project-for-codespaces/introduction-to-dev-containers)."
设置同步可让你在机器和 {% data variables.product.prodname_vscode_shortname %} 实例中同步配置,如设置、键盘快捷方式、片段、扩展和 UI 状态。
## Settings Sync
要启用设置同步,在 {% data variables.product.prodname_vscode %} 活动栏的左下角,选择 {% octicon "gear" aria-label="The gear icon" %} 并单击“打开设置同步...”。 在对话框中,选择要同步的设置。
Settings Sync allows you to synchronize configurations such as settings, keyboard shortcuts, snippets, extensions, and UI state across machines and instances of {% data variables.product.prodname_vscode_shortname %}.
![在管理菜单中设置同步选项](/assets/images/help/codespaces/codespaces-manage-settings-sync.png)
To enable Settings Sync, in the bottom-left corner of {% data variables.product.prodname_vscode %}'s Activity Bar, select {% octicon "gear" aria-label="The gear icon" %} and click **Turn on Settings Sync…**. In the dialog box, select the settings you'd like to sync.
![Setting Sync option in manage menu](/assets/images/help/codespaces/codespaces-manage-settings-sync.png)
For more information, see the [Settings Sync guide](https://code.visualstudio.com/docs/editor/settings-sync) in the {% data variables.product.prodname_vscode_shortname %} documentation.
有关详细信息,请参阅 {% data variables.product.prodname_vscode_shortname %} 文档中的[设置同步指南](https://code.visualstudio.com/docs/editor/settings-sync)。
## Dotfiles
Dotfiles are files and folders on Unix-like systems starting with `.` that control the configuration of applications and shells on your system. You can store and manage your dotfiles in a repository on {% data variables.product.prodname_dotcom %}. For advice and tutorials about what to include in your dotfiles repository, see [GitHub does dotfiles](https://dotfiles.github.io/).
Dotfiles 是类似 Unix 的系统上以 `.` 开头的文件和文件夹,用于控制系统上应用程序和 shell 的配置。 您可以在 {% data variables.product.prodname_dotcom %} 上的仓库中存储和管理 dotfiles。 有关 dotfiles 存储库中所含内容的建议和教程,请参阅 [GitHub 执行 dotfiles](https://dotfiles.github.io/)
Your dotfiles repository might include your shell aliases and preferences, any tools you want to install, or any other codespace personalization you want to make.
dotfiles 仓库可能包括 shell 别名和首选项、您想要安装的任何工具或您想要执行的任何其他代码个性化。
You can configure {% data variables.product.prodname_github_codespaces %} to use dotfiles from any repository you own by selecting that repository in your [personal {% data variables.product.prodname_github_codespaces %} settings](https://github.com/settings/codespaces).
可以在[个人 {% data variables.product.prodname_github_codespaces %} 设置](https://github.com/settings/codespaces)中选择存储库,将 {% data variables.product.prodname_github_codespaces %} 配置为使用你拥有的任何存储库中的 dotfiles。
When you create a new codespace, {% data variables.product.prodname_dotcom %} clones your selected dotfiles repository to the codespace environment, and looks for one of the following files to set up the environment.
创建新的 codespace 时,{% data variables.product.prodname_dotcom %} 会将所选点文件存储库克隆到 codespace 环境,并查找以下文件之一来设置环境。
* _install.sh_
* install.sh
* _install_
* _bootstrap.sh_
* bootstrap.sh
* _bootstrap_
* _script/bootstrap_
* script/bootstrap
* _setup.sh_
* _setup_
* _script/setup_
* setup
* script/setup
If none of these files are found, then any files or folders in your selected dotfiles repository starting with `.` are symlinked to the codespace's `~` or `$HOME` directory.
如果未找到这些文件,则所选 dotfiles 存储库中以 `.` 开头的文件或文件夹通过符号链接到代码空间的 `~` `$HOME` 目录。
Any changes to your selected dotfiles repository will apply only to each new codespace, and do not affect any existing codespace.
对所选 dotfiles 仓库所做的任何更改只会应用到每个新的代码空间,而不影响任何现有的代码空间。
{% note %}
**Note:** Currently, {% data variables.product.prodname_codespaces %} does not support personalizing the User-scoped settings for {% data variables.product.prodname_vscode_shortname %} with your `dotfiles` repository. You can set default Workspace and Remote [Codespaces] settings for a specific project in the project's repository. For more information, see "[Introduction to dev containers](/github/developing-online-with-codespaces/configuring-codespaces-for-your-project#creating-a-custom-dev-container-configuration)."
注意:目前,{% data variables.product.prodname_codespaces %} 不支持通过 `dotfiles` 存储库将 {% data variables.product.prodname_vscode_shortname %} 的用户范围的设置进行个性化。 可以为项目存储库中的特定项目设置默认“工作区”和“远程 [Codespaces]”设置。 有关详细信息,请参阅“[开发容器简介](/github/developing-online-with-codespaces/configuring-codespaces-for-your-project#creating-a-custom-dev-container-configuration)”。
{% endnote %}
### Enabling your dotfiles repository for {% data variables.product.prodname_codespaces %}
### {% data variables.product.prodname_codespaces %} 启用 dotfiles 存储库
You can use your selected dotfiles repository to personalize your {% data variables.product.prodname_github_codespaces %} environment. Once you choose your dotfiles repository, you can add your scripts, preferences, and configurations to it. You then need to enable your dotfiles from your personal {% data variables.product.prodname_github_codespaces %} settings page.
可以使用所选的 dotfiles 存储库来将 {% data variables.product.prodname_github_codespaces %} 环境个性化。 选择 dotfiles 存储库后,可以向其中添加脚本、首选项和配置。 然后,需要从个人 {% data variables.product.prodname_github_codespaces %} 设置页面启用 dotfiles。
{% warning %}
**Warning:** Dotfiles have the ability to run arbitrary scripts, which may contain unexpected or malicious code. Before installing a dotfiles repo, we recommend checking scripts to ensure they don't perform any unexpected actions.
警告Dotfiles 能够运行任意脚本,这些脚本可能包含意外或恶意代码。 在安装 dotfiles 存储库之前,我们建议检查脚本以确保它们不会执行任何意外操作。
{% endwarning %}
{% data reusables.user-settings.access_settings %}
{% data reusables.user-settings.codespaces-tab %}
1. Under "Dotfiles", select **Automatically install dotfiles** so that {% data variables.product.prodname_github_codespaces %} automatically installs your dotfiles into every new codespace you create.
![Installing dotfiles](/assets/images/help/codespaces/install-custom-dotfiles.png)
2. Choose the repository you want to install dotfiles from.
![Selecting a dotfiles repo](/assets/images/help/codespaces/select-dotfiles-repo.png)
{% data reusables.user-settings.access_settings %} {% data reusables.user-settings.codespaces-tab %}
1. 在“Dotfiles”下选择“自动安装 dotfiles”以便 {% data variables.product.prodname_github_codespaces %} 自动将 dotfiles 安装到你创建的每个新 codespace 中。
![安装 dotfiles](/assets/images/help/codespaces/install-custom-dotfiles.png)
2. 选择要从中安装 dotfile 的存储库。
![选择 dotfiles 存储库](/assets/images/help/codespaces/select-dotfiles-repo.png)
You can add further script, preferences, configuration files to your dotfiles repository or edit existing files whenever you want. Changes to settings will only be picked up by new codespaces.
您可以随时将更多脚本、首选项、配置文件添加到 dotfiles 存储库或编辑现有文件。 对设置的更改将仅由新的代码空间选取。
If your codespace fails to pick up configuration settings from dotfiles, see "[Troubleshooting dotfiles for {% data variables.product.prodname_github_codespaces %}](/codespaces/troubleshooting/troubleshooting-dotfiles-for-codespaces)."
如果 codespace 无法从 dotfiles 中选取配置设置,请参阅“[排查 {% data variables.product.prodname_github_codespaces %} 的 dotfiles 问题](/codespaces/troubleshooting/troubleshooting-dotfiles-for-codespaces)”。
## Other available settings
## 其他可用设置
You can also personalize {% data variables.product.prodname_github_codespaces %} using additional options in [your personal settings](https://github.com/settings/codespaces):
还可以使用[个人设置](https://github.com/settings/codespaces)中的其他选项对 {% data variables.product.prodname_github_codespaces %} 进行个性化设置:
- To enable GPG verification, see "[Managing GPG verification for {% data variables.product.prodname_github_codespaces %}](/codespaces/managing-your-codespaces/managing-gpg-verification-for-github-codespaces)."
- To set your editor, see "[Setting your default editor for {% data variables.product.prodname_github_codespaces %}](/codespaces/customizing-your-codespace/setting-your-default-editor-for-github-codespaces)."
- To set how long a codespace can remain unused before it is automatically stopped, see "[Setting your timeout period for {% data variables.product.prodname_github_codespaces %}](/codespaces/customizing-your-codespace/setting-your-timeout-period-for-github-codespaces)."
- To set the period for which your unused codespaces are retained, see "[Configuring automatic deletion of your codespaces](/codespaces/customizing-your-codespace/configuring-automatic-deletion-of-your-codespaces)."
- To set your default region, see "[Setting your default region for {% data variables.product.prodname_github_codespaces %}](/codespaces/customizing-your-codespace/setting-your-default-region-for-github-codespaces)."
- 若要启用 GPG 验证,请参阅“[管理 {% data variables.product.prodname_github_codespaces %} 的 GPG 验证](/codespaces/managing-your-codespaces/managing-gpg-verification-for-github-codespaces)”。
- 若要设置编辑器,请参阅“[ {% data variables.product.prodname_github_codespaces %} 设置默认编辑器](/codespaces/customizing-your-codespace/setting-your-default-editor-for-github-codespaces)”。
- 若要设置 codespace 在自动停止之前可能保持未使用状态的时间长度,请参阅“[设置 {% data variables.product.prodname_github_codespaces %} 超时期限](/codespaces/customizing-your-codespace/setting-your-timeout-period-for-github-codespaces)”。
- 若要设置保留未使用 codespace 的时间段,请参阅“[配置 codespace 的自动删除](/codespaces/customizing-your-codespace/configuring-automatic-deletion-of-your-codespaces)”。
- 若要设置默认区域,请参阅“[ {% data variables.product.prodname_github_codespaces %} 设置默认区域](/codespaces/customizing-your-codespace/setting-your-default-region-for-github-codespaces)”。
## Further reading
## 延伸阅读
* "[Creating a new repository](/github/creating-cloning-and-archiving-repositories/creating-a-new-repository)"
* "[Deep dive into {% data variables.product.prodname_github_codespaces %}](/codespaces/getting-started/deep-dive#personalizing-your-codespace-with-extensions-or-plugins)"
* [创建新存储库](/github/creating-cloning-and-archiving-repositories/creating-a-new-repository)
* [深入了解 {% data variables.product.prodname_github_codespaces %}](/codespaces/getting-started/deep-dive#personalizing-your-codespace-with-extensions-or-plugins)

View File

@@ -1,6 +1,6 @@
---
title: Renaming a codespace
intro: 'You can change the codespace display name to one of your choice through {% data variables.product.prodname_dotcom_the_website %} or the {% data variables.product.prodname_cli %}.'
title: 重命名 codespace
intro: '可以通过 {% data variables.product.prodname_dotcom_the_website %} {% data variables.product.prodname_cli %} 将 codespace 显示名称更改为所选名称之一。'
versions:
fpt: '*'
ghec: '*'
@@ -10,69 +10,74 @@ topics:
- Fundamentals
- Developer
shortTitle: Rename a codespace
ms.openlocfilehash: dcb4558cce7ca0768524917a46cde2a49bacd1ce
ms.sourcegitcommit: e8c012864f13f9146e53fcb0699e2928c949ffa8
ms.translationtype: HT
ms.contentlocale: zh-CN
ms.lasthandoff: 11/09/2022
ms.locfileid: '148158715'
---
## 关于重命名 codespace
## About renaming a codespace
为每个 codespace 分配一个自动生成的显示名称。 如果有多个 codespace则显示名称有助于区分不同 codespace。 例如:`literate space parakeet`。 可以更改 codespace 的显示名称。
Each codespace is assigned an auto-generated display name. If you have multiple codespaces, the display name helps you to differentiate between codespaces. For example: `literate space parakeet`. You can change the display name for your codespace.
若要查找 codespace 的显示名称,请执行以下操作:
To find the display name of a codespace:
- 在 {% data variables.product.product_name %} 上,在 https://github.com/codespaces 处查看 codespace 列表。
- On {% data variables.product.product_name %}, view your list of codespaces at https://github.com/codespaces.
![GitHub 中 codespace 列表的屏幕截图](/assets/images/help/codespaces/codespaces-list-display-name.png)
![Screenshot of the list of codespaces in GitHub](/assets/images/help/codespaces/codespaces-list-display-name.png)
- 在 {% data variables.product.prodname_vscode %} 桌面应用程序中,或在 {% data variables.product.prodname_vscode_shortname %} Web 客户端中,单击远程资源管理器。 显示名称是列表中的第二项。 例如:以下屏幕截图中的 `symmetrical space telegram`
- In the {% data variables.product.prodname_vscode %} desktop application, or the {% data variables.product.prodname_vscode_shortname %} web client, click the Remote Explorer. The display name is the second item in the list. For example: `symmetrical space telegram` in the screenshot below.
![Screenshot of the Remote Explorer in VS Code](/assets/images/help/codespaces/codespaces-remote-explorer.png)
![VS Code 中远程资源管理器的屏幕截图](/assets/images/help/codespaces/codespaces-remote-explorer.png)
{% indented_data_reference reusables.codespaces.remote-explorer spaces=2 %}
- In a terminal window on your local machine, use this {% data variables.product.prodname_cli %} command: `gh codespace list`.
- 在本地计算机上的终端窗口中,使用这条 {% data variables.product.prodname_cli %} 命令:`gh codespace list`
### Permanent codespace names
### 永久 codespace 名称
In addition to the display name, when you create a codespace, a permanent name is also assigned to the codespace. The name is a combination of your {% data variables.product.company_short %} handle, and the auto-generated display name. For example: `octocat-literate-space-parakeet-mld5`. You can't change the permanent name.
创建 codespace 时,除了显示名称,还会向 codespace 分配永久名称。 该名称是 {% data variables.product.company_short %} 句柄以及自动生成的显示名称的组合。 例如:`octocat-literate-space-parakeet-mld5`。 无法更改永久名称。
To find the permanent name of a codespace:
若要查找 codespace 的永久名称,请执行以下操作:
* On {% data variables.product.product_name %}, the permanent name is shown in a pop-up when you hover over the display name of a codespace on https://github.com/codespaces.
* {% data variables.product.product_name %} 上,将鼠标悬停在 https://github.com/codespaces 上 codespace 的显示名称上时,永久名称会显示在弹出窗口中。
![Screenshot of the codespace name shown on hover over](/assets/images/help/codespaces/find-codespace-name-github.png)
![悬停时显示的 codespace 名称的屏幕截图](/assets/images/help/codespaces/find-codespace-name-github.png)
* In a codespace, use this command in the terminal: `echo $CODESPACE_NAME`.
* In a terminal window on your local machine, use this {% data variables.product.prodname_cli %} command: `gh codespace list`.
* codespace 中,在终端中使用此命令:`echo $CODESPACE_NAME`
* 在本地计算机上的终端窗口中,使用这条 {% data variables.product.prodname_cli %} 命令:`gh codespace list`
## Renaming a codespace
## 重命名 codespace
Changing the display name of a codespace can be useful if you have multiple codespaces that you will be using for an extended period. An appropriate name helps you identify a codespace that you use for a particular purpose.
如果有多个要在较长时间内使用的 codespace更改 codespace 的显示名称可能很有用。 适当的名称有助于识别用于特定用途的 codespace。
{% cli %}
You can change the display name for your codespace by using the {% data variables.product.prodname_cli %}.
可以使用 {% data variables.product.prodname_cli %} 更改 codespace 的显示名称。
To rename a codespace, use the `gh codespace edit` subcommand:
若要为 codespace 重命名,请使用 `gh codespace edit` 子命令:
```shell
gh codespace edit -c PERMANENT-CODESPACE-NAME -d NEW-DISPLAY-NAME
```
In this example, replace `PERMANENT-CODESPACE-NAME` with the permanent name of the codespace whose display name you want to change. Replace `NEW-DISPLAY-NAME` with the display name you want to use for this codespace.
在本例中,用想要更改其显示名称的 codespace 的永久名称替换 `PERMANENT-CODESPACE-NAME`。 用想用于此 codespace 的显示名称替换 `NEW-DISPLAY-NAME`
For more information, see "[Using {% data variables.product.prodname_github_codespaces %} with {% data variables.product.prodname_cli %}](/codespaces/developing-in-codespaces/using-github-codespaces-with-github-cli#rename-a-codespace)."
有关详细信息,请参阅“[ {% data variables.product.prodname_github_codespaces %} {% data variables.product.prodname_cli %} 配合使用](/codespaces/developing-in-codespaces/using-github-codespaces-with-github-cli#rename-a-codespace)
{% endcli %}
{% webui %}
You can change the display name for your codespace on {% data variables.product.prodname_dotcom_the_website %}.
可以在 {% data variables.product.prodname_dotcom_the_website %} 上更改 codespace 的显示名称。
{% data reusables.codespaces.your-codespaces-procedure-step %}
The current display name for each of your codespaces is displayed.
{% data reusables.codespaces.ellipsis-settings %}
1. Click **Rename**.
1. 单击“重命名”。
1. In the prompt, under "Change display name to..." type your desired display name and click **OK**.
1. 在提示符中,在“将显示名称更改为...”下键入所需的显示名称,然后单击“ 确定”。
{% endwebui %}
{% endwebui %}

View File

@@ -1,5 +1,5 @@
---
title: Setting your default editor for GitHub Codespaces
title: 设置 GitHub Codespaces 的默认编辑器
shortTitle: Set the default editor
intro: '{% data reusables.codespaces.about-changing-default-editor %}'
versions:
@@ -11,40 +11,44 @@ redirect_from:
topics:
- Codespaces
type: how_to
ms.openlocfilehash: 5c286ffe8f96d275dc0b20949a87b7ced411c9af
ms.sourcegitcommit: e8c012864f13f9146e53fcb0699e2928c949ffa8
ms.translationtype: HT
ms.contentlocale: zh-CN
ms.lasthandoff: 11/09/2022
ms.locfileid: '148159443'
---
On the settings page, you can set your editor preference so that when you create a codespace, or open an existing codespace, it is opened in your choice of:
* {% data variables.product.prodname_vscode %} (desktop application)
* {% data variables.product.prodname_vscode %} (web client application)
* JetBrains Gateway - for opening codespaces in a JetBrains IDE
* JupyterLab - the web interface for Project Jupyter
在“设置”页上,可以设置编辑器首选项,以便在创建 codespace 或打开现有 codespace 时,它会在所选的以下选项中打开:
* {% data variables.product.prodname_vscode %}(桌面应用程序)
* {% data variables.product.prodname_vscode %}Web 客户端应用程序)
* JetBrains 网关 - 用于在 JetBrains IDE 中打开 codespace
* JupyterLab - Project Jupyter 的 Web 接口
{% data reusables.codespaces.template-codespaces-default-editor %}
If you want to use {% data variables.product.prodname_vscode %} as your default editor for {% data variables.product.prodname_github_codespaces %}, you need to install {% data variables.product.prodname_vscode %} and the {% data variables.product.prodname_github_codespaces %} extension for {% data variables.product.prodname_vscode %}. For more information, see the [download page for {% data variables.product.prodname_vscode %}](https://code.visualstudio.com/download/) and the [{% data variables.product.prodname_github_codespaces %} extension on the {% data variables.product.prodname_vscode %} marketplace](https://marketplace.visualstudio.com/items?itemName=GitHub.codespaces).
如果要将 {% data variables.product.prodname_vscode %} 用作 {% data variables.product.prodname_github_codespaces %} 的默认编辑器,则需要安装 {% data variables.product.prodname_vscode %} {% data variables.product.prodname_vscode %} 的 {% data variables.product.prodname_github_codespaces %} 扩展。 有关详细信息,请参阅 [{% data variables.product.prodname_vscode %} 的下载页](https://code.visualstudio.com/download/) [{% data variables.product.prodname_vscode %} 市场中的 {% data variables.product.prodname_github_codespaces %} 扩展](https://marketplace.visualstudio.com/items?itemName=GitHub.codespaces)
If you want to work on a codespace in a JetBrains IDE you must install the JetBrains Gateway. For more information, see "[Using {% data variables.product.prodname_github_codespaces %} in your JetBrains IDE](/codespaces/developing-in-codespaces/using-github-codespaces-in-your-jetbrains-ide)."
如果要在 JetBrains IDE 中使用 codespace,则必须安装 JetBrains 网关。 有关详细信息,请参阅“[在 JetBrains IDE 中使用 {% data variables.product.prodname_github_codespaces %}](/codespaces/developing-in-codespaces/using-github-codespaces-in-your-jetbrains-ide)”。
## Setting your default editor
## 设置默认编辑器
{% data reusables.user-settings.access_settings %}
{% data reusables.user-settings.codespaces-tab %}
1. Under "Editor preference", select the option you want.
{% data reusables.user-settings.access_settings %} {% data reusables.user-settings.codespaces-tab %}
1. 在“Editor preference编辑器首选项”下选择所需的选项。
![Setting your editor](/assets/images/help/codespaces/select-default-editor.png)
![设置编辑器](/assets/images/help/codespaces/select-default-editor.png)
* {% data reusables.codespaces.application-installed-locally %}<br><br>
* If you choose **{% data variables.product.prodname_vscode %}**, {% data variables.product.prodname_github_codespaces %} will automatically open in the desktop application when you next create or open a codespace.
* 如果选择“{% data variables.product.prodname_vscode %}”,在下次创建或打开 codespace 时,{% data variables.product.prodname_github_codespaces %} 将自动在桌面应用程序中打开。
You may need to allow access to both your browser and {% data variables.product.prodname_vscode %} for it to open successfully.<br><br>
您可能需要同时允许访问浏览器和 {% data variables.product.prodname_vscode %} 才能成功打开。<br><br>
* If you choose **JetBrains Gateway**, the Gateway application will automatically open when you next create or open a codespace.
* 如果选择“JetBrains 网关”,则下次创建或打开 codespace 时,网关应用程序将自动打开。
The first time you open a codespace this way you must give permission to open the application.
首次以这种方式打开 codespace 时,必须授予打开该应用程序的权限。
The Gateway application will open and the codespace will then be automatically selected. You can then choose a JetBrains IDE, if you have not previously done so, and click **Connect** to open the codespace in the JetBrains client. For more information, see "[Using {% data variables.product.prodname_github_codespaces %} in your JetBrains IDE](/codespaces/developing-in-codespaces/using-github-codespaces-in-your-jetbrains-ide)."
网关应用程序将打开,然后会自动选择 codespace。 然后,可以选择 JetBrains IDE如果之前没有选择然后单击“连接”在 JetBrains 客户端中打开 codespace。 有关详细信息,请参阅“[在 JetBrains IDE 中使用 {% data variables.product.prodname_github_codespaces %}](/codespaces/developing-in-codespaces/using-github-codespaces-in-your-jetbrains-ide)”。
To connect to a codespace from the Gateway application, you must have an SSH server running on the codespace. {% indented_data_reference reusables.codespaces.ssh-server-installed spaces=5 %}
若要从网关应用程序连接到 codespace必须在 codespace 上运行 SSH 服务器。 {% indented_data_reference reusables.codespaces.ssh-server-installed spaces=5 %}
* If you choose **JupyterLab**, the JupyterLab application must be installed in the codespaces you open. {% data reusables.codespaces.jupyterlab-in-default-image %}
* 如果选择“JupyterLab”则必须在打开的 codespace 中安装 JupyterLab 应用程序。 {% data reusables.codespaces.jupyterlab-in-default-image %}

View File

@@ -1,7 +1,7 @@
---
title: Setting your timeout period for GitHub Codespaces
title: 设置 GitHub Codespaces 超时期限
shortTitle: Set the timeout
intro: 'You can set your default timeout for {% data variables.product.prodname_github_codespaces %} in your personal settings page.'
intro: '可以在个人设置页面中设置 {% data variables.product.prodname_github_codespaces %} 的默认超时。'
versions:
fpt: '*'
ghec: '*'
@@ -10,53 +10,57 @@ topics:
type: how_to
redirect_from:
- /codespaces/customizing-your-codespace/setting-your-timeout-period-for-codespaces
ms.openlocfilehash: 6ca559fefddc34eb6de0441d17344ff8054db509
ms.sourcegitcommit: e8c012864f13f9146e53fcb0699e2928c949ffa8
ms.translationtype: HT
ms.contentlocale: zh-CN
ms.lasthandoff: 11/09/2022
ms.locfileid: '148159442'
---
## 关于空闲超时
## About the idle timeout
A codespace will stop running after a period of inactivity. By default this period is 30 minutes, but you can specify a longer or shorter default timeout period in your personal settings on {% data variables.product.prodname_dotcom %}. The updated setting will apply to any new codespaces you create, or to existing codespaces the next time you start them. You can also specify a timeout when you use {% data variables.product.prodname_cli %} to create a codespace.
代码空间将在一段时间不活动后停止运行。 默认情况下,此时间段为 30 分钟,但你可以在 {% data variables.product.prodname_dotcom %} 上的个人设置中指定更长或更短的默认超时期限。 更新后的设置将应用于你创建的任何新 codespaces或者在下次启动 codespaces 时应用于现有 codespaces。 还可以在使用 {% data variables.product.prodname_cli %} 创建 codespace 时指定超时。
{% warning %}
**Warning**: Codespaces compute usage is billed for the duration for which a codespace is active. If you're not using a codespace but it remains running, and hasn't yet timed out, you are billed for the total time that the codespace was active, irrespective of whether you were using it. For more information, see "[About billing for {% data variables.product.prodname_github_codespaces %}](/billing/managing-billing-for-github-codespaces/about-billing-for-github-codespaces#codespaces-pricing)."
警告:在 codespace 处于活动状态期间对 codespaces 计算用量计费。 如果未使用 codespace但它仍在运行并且尚未超时则无论是否正在使用 codespace你都需按 codespace 处于活动状态的总时间付费。 有关详细信息,请参阅“[关于 {% data variables.product.prodname_github_codespaces %} 的计费](/billing/managing-billing-for-github-codespaces/about-billing-for-github-codespaces#codespaces-pricing)”。
{% endwarning %}
### Timeout periods for organization-owned repositories
### 组织拥有的存储库的超时时段
Organizations can set a maximum idle timeout policy for codespaces created from some or all of their repositories. If an organization policy sets a maximum timeout which is less than the default timeout you have set, the organization's timeout will be used instead of your setting. You will be notified of this after the codespace is created. For more information, see "[Restricting the idle timeout period](/codespaces/managing-codespaces-for-your-organization/restricting-the-idle-timeout-period)."
组织可以为从其部分或所有存储库创建的 codespace 设置最大空闲超时策略。 如果组织策略设置的最大超时时间少于你设置的默认超时时间,将使用组织的超时时间而不是你设置的超时时间。 你将在 codespace 创建后收到此通知。 有关详细信息,请参阅“[限制空闲超时期限](/codespaces/managing-codespaces-for-your-organization/restricting-the-idle-timeout-period)”。
{% webui %}
## Setting your default timeout period
## 设置默认超时期限
{% data reusables.user-settings.access_settings %}
{% data reusables.user-settings.codespaces-tab %}
1. Under "Default idle timeout", enter the time that you want, then click **Save**. The time must be between 5 minutes and 240 minutes (4 hours).
![Selecting your timeout](/assets/images/help/codespaces/setting-default-timeout.png)
{% data reusables.user-settings.access_settings %} {% data reusables.user-settings.codespaces-tab %}
1. 在“默认空闲超时”下,输入所需时间,然后单击“保存”。 时间必须在 5 分钟到 240 分钟4 小时)之间。
![选择超时](/assets/images/help/codespaces/setting-default-timeout.png)
{% endwebui %}
{% cli %}
## Setting the timeout period for a codespace
## 设置 codespace 的超时期限
{% data reusables.cli.cli-learn-more %}
To set the timeout period when you create a codespace, use the `idle-timeout` argument with the `codespace create` subcommand. Specify the time in minutes, followed by `m`. The time must be between 5 minutes and 240 minutes (4 hours).
若要设置创建代码空间时的超时期限,请将 `idle-timeout` 参数与 `codespace create` 子命令一起使用。 指定以分钟为单位的时间,后跟 `m`。 时间必须在 5 分钟到 240 分钟4 小时)之间。
```shell
gh codespace create --idle-timeout 90m
```
If you don't specify a timeout period when you create a codespace, then the default timeout period will be used. For information about setting a default timeout period, click the "Web browser" tab on this page. You can't currently specify a default timeout period through {% data variables.product.prodname_cli %}.
如果在创建代码空间时未指定超时期限,则将使用默认超时期限。 有关设置默认超时期限的信息请单击此页面上的“Web browserWeb 浏览器)”选项卡。 您当前无法通过 {% data variables.product.prodname_cli %} 指定默认超时期限。
{% endcli %}
{% vscode %}
## Setting a timeout period
## 设置超时期限
You can set your default timeout period in your web browser, on {% data variables.product.prodname_dotcom_the_website %}. Alternatively, if you use {% data variables.product.prodname_cli %} to create a codespace you can set a timeout period for that particular codespace. For more information, click the appropriate tab above.
可以通过 Web 浏览器在 {% data variables.product.prodname_dotcom_the_website %} 上设置默认超时期限。 或者,如果使用 {% data variables.product.prodname_cli %} 创建 codespace则可以为该特定 codespace 设置超时期限。 有关详细信息,请单击上面相应的选项卡。
{% endvscode %}

View File

@@ -1,6 +1,6 @@
---
title: Connecting to a private network
intro: 'You can connect {% data variables.product.prodname_github_codespaces %} to resources on a private network, including package registries, license servers, and on-premises databases.'
title: 连接到专用网络
intro: '可以将 {% data variables.product.prodname_github_codespaces %} 连接到专用网络上的资源,包括包注册表、许可证服务器和本地数据库。'
versions:
fpt: '*'
ghec: '*'
@@ -9,51 +9,56 @@ topics:
- Codespaces
- Fundamentals
- Developer
ms.openlocfilehash: 92b8f2b9ea438a4cc799aec1969ff6773f90c298
ms.sourcegitcommit: e8c012864f13f9146e53fcb0699e2928c949ffa8
ms.translationtype: HT
ms.contentlocale: zh-CN
ms.lasthandoff: 11/09/2022
ms.locfileid: '148159441'
---
## 关于代码空间网络
## About codespace networking
默认情况下,您的代码空间有权访问公共 Internet 上的所有资源,包括包管理器、许可证服务器、数据库和云平台 API但它们无权访问专用网络上的资源。
By default, your codespaces have access to all resources on the public internet, including package managers, license servers, databases, and cloud platform APIs, but they have no access to resources on private networks.
## 连接到专用网络上的资源
## Connecting to resources on a private network
目前,在 {% data variables.product.prodname_github_codespaces %} 内访问专用网络上的资源有两种方法。
- 使用 {% data variables.product.prodname_cli %} 扩展将本地计算机配置为远程资源的网关。
- 使用 VPN。
There are currently two methods of accessing resources on a private network within {% data variables.product.prodname_github_codespaces %}.
- Using a {% data variables.product.prodname_cli %} extension to configure your local machine as a gateway to remote resources.
- Using a VPN.
### Using the GitHub CLI extension to access remote resources
### 使用 GitHub CLI 扩展访问远程资源
{% note %}
**Note**: The {% data variables.product.prodname_cli %} extension is currently in beta and subject to change.
注意:{% data variables.product.prodname_cli %} 扩展目前为 beta 版本,可能会有变动。
{% endnote %}
The {% data variables.product.prodname_cli %} extension allows you to create a bridge between a codespace and your local machine, so that the codespace can access any remote resource that is accessible from your machine. The codespace uses your local machine as a network gateway to reach those resources. For more information, see "[Using {% data variables.product.prodname_cli %} to access remote resources](https://github.com/github/gh-net#codespaces-network-bridge)."
可以使用 {% data variables.product.prodname_cli %} 扩展在 codespace 和本地计算机之间创建网桥,以便 codespace 可以访问可从计算机访问的任何远程资源。 codespace 使用本地计算机作为网络网关访问这些资源。 有关详细信息,请参阅“[使用 {% data variables.product.prodname_cli %} 访问远程资源](https://github.com/github/gh-net#codespaces-network-bridge)”。
### Using a VPN to access resources behind a private network
### 使用 VPN 访问专用网络后面的资源
As an alternative to the {% data variables.product.prodname_cli %} extension, you can use a VPN to access resources behind a private network from within your codespace.
作为 {% data variables.product.prodname_cli %} 扩展的替代方法,可以使用 VPN 从 codespace 内访问专用网络后面的资源。
We recommend VPN tools like [OpenVPN](https://openvpn.net/) to access resources on a private network. For more information, see "[Using the OpenVPN client from {% data variables.product.prodname_github_codespaces %}](https://github.com/codespaces-contrib/codespaces-openvpn)."
建议使用 [OpenVPN](https://openvpn.net/) 等 VPN工具访问专用网络上的资源。 有关详细信息,请参阅“[ {% data variables.product.prodname_github_codespaces %} 使用 OpenVPN 客户端](https://github.com/codespaces-contrib/codespaces-openvpn)”。
There are also a number of third party solutions that, while not explicitly endorsed by {% data variables.product.prodname_dotcom %}, have provided examples of how to integrate with {% data variables.product.prodname_github_codespaces %}.
还有一些第三方解决方案虽然没有得到 {% data variables.product.prodname_dotcom %} 的明确认可,但提供了如何与 {% data variables.product.prodname_github_codespaces %} 集成的示例。
These third party solutions include:
这些第三方解决方案包括:
- [Tailscale](https://tailscale.com/kb/1160/github-codespaces/)
### Allowlisting private resources for codespaces
### 将代码空间的私有资源列入允许列表
While {% data variables.product.prodname_dotcom %} publishes IP ranges for several products on its Meta API, codespaces IPs are dynamically assigned, meaning your codespace is not guaranteed to have the same IP address day to day. We highly discourage users from allowlisting an entire IP range, as this would give overly broad access to all codespaces (including users not affiliated with your codespaces).
虽然 {% data variables.product.prodname_dotcom %} 在其 Meta API 上发布多个产品的 IP 范围,但代码空间 IP 是动态分配的,这意味着您的代码空间不能保证每天具有相同的 IP 地址。 我们强烈建议用户不要允许列出整个 IP 范围,因为这样用户能够过于宽泛地访问所有代码空间(包括与您的代码空间无关的用户)。
For more information about the Meta API, see "[Meta](/rest/reference/meta)."
有关 Meta API 的详细信息,请参阅“[Meta](/rest/reference/meta)”。
## Restricting access to the public internet
## 限制对公共互联网的访问
At present, there is no way to restrict codespaces from accessing the public internet, or to restrict appropriately authenticated users from accessing a forwarded port.
目前,没有办法限制代码空间访问公共互联网,或者限制经过适当身份验证的用户访问转发端口。
For more information on how to secure your codespaces, see "[Security in {% data variables.product.prodname_github_codespaces %}](/codespaces/codespaces-reference/security-in-github-codespaces)."
有关如何保护 codespace 的详细信息,请参阅“[{% data variables.product.prodname_github_codespaces %} 中的安全性](/codespaces/codespaces-reference/security-in-github-codespaces)”。

View File

@@ -0,0 +1,145 @@
---
title: Creating a codespace for a repository
intro: You can create a codespace for a branch in a repository to develop online.
redirect_from:
- /github/developing-online-with-github-codespaces/creating-a-codespace
- /github/developing-online-with-codespaces/creating-a-codespace
- /codespaces/developing-in-codespaces/creating-a-codespace
versions:
fpt: '*'
ghec: '*'
type: how_to
topics:
- Codespaces
- Fundamentals
- Developer
shortTitle: Create a codespace for a repo
---
## About creating a codespace for a repository
{% data reusables.codespaces.ways-to-create-a-codespace %} Use the tabs in this article to display instructions for each of these ways of creating a codespace.
{% data reusables.codespaces.starting-new-project-template %} For more information, see "[Creating a codespace from a template](/codespaces/developing-in-codespaces/creating-a-codespace-from-a-template)."
{% note %}
**Note**: If you use a JetBrains IDE, you can use {% data variables.product.prodname_cli %} to create a codespace. You can then use the JetBrains Gateway application to open the codespace in a JetBrains IDE. For more information, see "[Using Codespaces in your JetBrains IDE](/codespaces/developing-in-codespaces/using-github-codespaces-in-your-jetbrains-ide)."
{% endnote %}
You can use {% data variables.product.prodname_github_codespaces %} on your personal {% data variables.product.prodname_dotcom_the_website %} account, with the quota of free use included each month for accounts on the Free and Pro plans. {% data reusables.codespaces.codespaces-continue-by-paying %}
Organizations can enable members and outside collaborators to create and use codespaces at the organization's expense. For more information, see "[Enabling {% data variables.product.prodname_github_codespaces %} for your organization](/codespaces/managing-codespaces-for-your-organization/enabling-github-codespaces-for-your-organization)."
{% data reusables.codespaces.codespaces-are-personal %}
If you create a codespace from a repository, the codespace will be associated with a specific branch, which cannot be empty. You can create more than one codespace per repository or even per branch.
{% data reusables.codespaces.you-can-see-all-your-codespaces %}
### The codespace creation process
When you create a codespace, a number of steps happen to create and connect you to your development environment:
- Step 1: VM and storage are assigned to your codespace.
- Step 2: Container is created and your repository is cloned.
- Step 3: You can connect to the codespace.
- Step 4: Codespace continues with post-creation setup.
For more information on what happens when you create a codespace, see "[Deep Dive](/codespaces/getting-started/deep-dive)."
For more information on the lifecycle of a codespace, see "[The codespace lifecycle](/codespaces/developing-in-codespaces/the-codespace-lifecycle)."
If you want to use Git hooks for your codespace, then you should set up hooks using the [`devcontainer.json` lifecycle scripts](https://code.visualstudio.com/docs/remote/devcontainerjson-reference#_lifecycle-scripts), such as `postCreateCommand`, during step 4. Since your codespace container is created after the repository is cloned, any [git template directory](https://git-scm.com/docs/git-init#_template_directory) configured in the container image will not apply to your codespace. Hooks must instead be installed after the codespace is created. For more information on using `postCreateCommand`, see the [`devcontainer.json` reference](https://code.visualstudio.com/docs/remote/devcontainerjson-reference#_devcontainerjson-properties) in the {% data variables.product.prodname_vscode_shortname %} documentation.
{% data reusables.codespaces.use-visual-studio-features %}
{% data reusables.codespaces.prebuilds-crossreference %}
## Creating a codespace for a repository
{% webui %}
{% data reusables.repositories.navigate-to-repo %}
1. Under the repository name, use the "Branch" dropdown menu, and select the branch you want to create a codespace for.
![Branch dropdown menu](/assets/images/help/codespaces/branch-drop-down.png)
1. Click the **{% octicon "code" aria-label="The code icon" %} Code** button, then click the **Codespaces** tab.
![New codespace button](/assets/images/help/codespaces/new-codespace-button.png)
If codespaces for this repository are billable to an organization, or its parent enterprise, a message is displayed below the **Create codespace on BRANCH** button telling you who will pay for the codespace.
1. Create your codespace, either using the default options, or after configuring advanced options:
* **Use the default options**
To create a codespace using the default options, click the plus sign ({% octicon "plus" aria-label="The plus icon" %}). Alternatively, if you don't currently have any codespaces for this repository, you can click **Create codespace on BRANCH**.
* **Configure options**
To configure advanced options for your codespace, such as a different machine type or a particular `devcontainer.json` file:
1. Click the ellipsis (**...**) at the top right of the **Codespaces** tab and select **New with options**.
![View the default machine type](/assets/images/help/codespaces/default-machine-type.png)
1. On the options page for your codespace, choose your preferred options from the dropdown menus.
![The codespace options page](/assets/images/help/codespaces/advanced-options.png)
{% note %}
**Notes**
* You can bookmark the options page to give you a quick way to create a codespace for this repository and branch.
* The [https://github.com/codespaces/new](https://github.com/codespaces/new) page provides a quick way to create a codespace for any repository and branch. You can get to this page quickly by typing `codespace.new` into your browser's address bar.
* For more information about the `devcontainer.json` file, see "[Introduction to dev containers](/codespaces/setting-up-your-project-for-codespaces/introduction-to-dev-containers#devcontainerjson)."
* For more information about machine types, see "[Changing the machine type for your codespace](/codespaces/customizing-your-codespace/changing-the-machine-type-for-your-codespace#about-machine-types)."
* {% data reusables.codespaces.codespaces-machine-type-availability %}
{% endnote %}
1. Click **Create codespace**.
{% endwebui %}
{% vscode %}
{% data reusables.codespaces.creating-a-codespace-in-vscode %}
{% endvscode %}
{% cli %}
{% data reusables.cli.cli-learn-more %}
To create a new codespace, use the `gh codespace create` subcommand.
```shell
gh codespace create
```
You are prompted to choose a repository. If codespaces for this repository are billable to an organization, or its parent enterprise, a message is displayed telling you who will pay for the codespace. You are then prompted to choose a branch, a dev container configuration file (if more than one is available), and a machine type (if more than one is available).
Alternatively, you can use flags to specify some or all of the options:
```shell
gh codespace create -r OWNER/REPO -b BRANCH --devcontainer-path PATH -m MACHINE-TYPE
```
In this example, replace `owner/repo` with the repository identifier. Replace `branch` with the name of the branch, or the full SHA hash of the commit, that you want to be initially checked out in the codespace. If you use the `-r` flag without the `b` flag, the codespace is created from the default branch.
Replace `path` with the path to the dev container configuration file you want to use for the new codespace. If you omit this flag and more than one dev container file is available you will be prompted to choose one from a list. For more information about the dev container configuration file, see "[Introduction to dev containers](/codespaces/setting-up-your-project-for-codespaces/introduction-to-dev-containers)."
Replace `machine-type` with a valid identifier for an available machine type. Identifiers are strings such as: `basicLinux32gb` and `standardLinux32gb`. The type of machines that are available depends on the repository, your personal account, and your location. If you enter an invalid or unavailable machine type, the available types are shown in the error message. If you omit this flag and more than one machine type is available you will be prompted to choose one from a list.
For full details of the options for this command, see [the {% data variables.product.prodname_cli %} manual](https://cli.github.com/manual/gh_codespace_create).
{% endcli %}
## Further reading
- "[Opening an existing codespace](/codespaces/developing-in-codespaces/opening-an-existing-codespace)"
- "[Adding an 'Open in {% data variables.product.prodname_github_codespaces %}' badge](/codespaces/setting-up-your-project-for-codespaces/adding-a-codespaces-badge)"

View File

@@ -0,0 +1,102 @@
---
title: Creating a codespace from a template
intro: If you're starting a new project, you can create a codespace from a blank template or choose a template specially designed for the type of work you want to do.
versions:
fpt: '*'
ghec: '*'
type: how_to
topics:
- Codespaces
- Fundamentals
- Developer
shortTitle: Create a codespace from a template
miniTocMaxHeadingLevel: 3
---
## About templates for {% data variables.product.prodname_github_codespaces %}
If you're starting a new project, you can get started with development work quickly by creating a codespace from a template. You'll be able to work on your project in a cloud-based development environment, save your files in the cloud, and publish your work to a new remote repository that you can share with others or clone to your local machine.
{% note %}
**Note**: Codespaces created from a template, rather than from a repository, are always billed to your personal account. For more information, see "[About billing for {% data variables.product.prodname_github_codespaces %}](/billing/managing-billing-for-github-codespaces/about-billing-for-github-codespaces)."
{% endnote %}
You can start from a blank template, choose from templates maintained by {% data variables.product.company_short %} for popular technologies such as React or Jupyter Notebook, or launch a codespace from any template repository on {% data variables.product.prodname_dotcom %}. With a blank template, you'll start with an empty directory, with access to cloud-based compute resources and the tools, languages, and runtime environments that come preinstalled with the default codespace image. With other templates, you'll get starter files for the technology you're working with, plus typically some extra files such as a README file, a `.gitignore` file, and dev container configuration files containing some custom environment configuration. For more information on dev containers and the default image, see "[Introduction to dev containers](/codespaces/setting-up-your-project-for-codespaces/introduction-to-dev-containers)."
As an example, if you create a codespace from {% data variables.product.company_short %}'s React template, you'll arrive in a workspace containing template files for a simple application, such as `index.js`, `app.js`, and `package.json`. Shortly after the codespace opens, a development server will start up automatically, and you will be able to view the running application in a simple browser tab within the {% data variables.product.prodname_vscode_shortname %} web client.
![Screenshot of the React template running in a codespace](/assets/images/help/codespaces/react-template.png)
The files and configuration included in templates are defined in template repositories. The template repository is cloned into your codespace when you create the codespace. After that, the link is severed, and your codespace won't be linked to a remote repository until you publish to one.
{% tip %}
**Tip:** To help people get started with your framework, library, or other project, you can set up a template repository for use with {% data variables.product.prodname_github_codespaces %}. For more information, see "[Setting up a template repository for {% data variables.product.prodname_github_codespaces %}](/codespaces/setting-up-your-project-for-codespaces/setting-up-a-template-repository-for-github-codespaces)."
{% endtip %}
## Creating a codespace from a {% data variables.product.company_short %} template
Templates maintained by {% data variables.product.company_short %}, including the blank template, are available from the "Your codespaces" page.
{% data reusables.codespaces.your-codespaces-procedure-step %}
{% data reusables.codespaces.view-all-templates-step %}
1. Optionally, to view the template repository containing the files for a template, click the name of the template.
![Screenshot of the "Explore quick start templates" section, with "React" highlighted](/assets/images/help/codespaces/react-template-name.png)
1. Under the template you want to launch, click **Use this template**.
![Screenshot of the quick start templates, with the "Use this template" button highlighted under the React template](/assets/images/help/codespaces/react-template-button.png)
{% data reusables.codespaces.template-codespaces-default-editor %}
## Creating a codespace from a template repository
You can create a codespace from any template repository, then publish your work to a new repository when you are ready. For more information on template repositories, see "[Creating a repository from a template](/repositories/creating-and-managing-repositories/creating-a-repository-from-a-template#about-repository-templates)."
{% data reusables.repositories.navigate-to-repo %}
{% data reusables.codespaces.open-template-in-codespace-step %}
{% note %}
**Note:** If you're a maintainer of the template repository, and want to commit changes to the template repository itself, you should create a codespace from the **{% octicon "code" aria-label="The code icon" %} Code** dropdown. For more information, see "[Creating a codespace for a repository](/codespaces/developing-in-codespaces/creating-a-codespace-for-a-repository#creating-a-codespace-for-a-repository)."
{% endnote %}
{% data reusables.codespaces.template-codespaces-default-editor %}
## Publishing to a repository on {% data variables.product.product_name %}
{% data reusables.codespaces.about-publishing-templates %}
### Publishing from {% data variables.product.prodname_vscode_shortname %}
{% data reusables.codespaces.publishing-template-codespaces %}
When a codespace is published, you have access to a greater range of options to customize your {% data variables.product.prodname_github_codespaces %} experience. For example, you can:
- Change the machine type of your codespace to make sure you're using resources appropriate for the work you're doing (see "[Changing the machine type for your codespace](/codespaces/customizing-your-codespace/changing-the-machine-type-for-your-codespace)").
- Allow {% data variables.product.prodname_dotcom %} to automatically use GPG to sign commits you make in your codespace (see "[Managing GPG verification for {% data variables.product.prodname_github_codespaces %}](/codespaces/managing-your-codespaces/managing-gpg-verification-for-github-codespaces)").
- Share encrypted secrets with your codespace (see "[Managing encrypted secrets for your codespaces](/codespaces/managing-your-codespaces/managing-encrypted-secrets-for-your-codespaces)").
### Publishing from {% data variables.product.prodname_dotcom_the_website %}
You can publish an unpublished codespace from the "Your codespaces" page on {% data variables.product.prodname_dotcom_the_website %}. This is useful if you want to publish a codespace that you don't currently have open in your browser. If you do this, your work will be preserved in a repository, but there won't be a link between your existing codespace and the new repository. However, you can navigate to the new repository and create a codespace from there, and this codespace will be connected to the repository.
{% data reusables.codespaces.your-codespaces-procedure-step %}
1. Next to the unpublished codespace, click the ellipsis (**...**), then select **Publish to a new repository**.
![Screenshot of the "Publish to a new repository" button](/assets/images/help/codespaces/publish-to-new-repository.png)
1. Choose a name for your new repository, set it as **Public** or **Private**, and click **Create repository**.
![Screenshot of the "Publish to a new repository" dropdown](/assets/images/help/codespaces/template-new-repository-settings.png)
1. Optionally, to view the new repository, click **See repository**.
## Further reading
- "[Creating a codespace for a repository](/codespaces/developing-in-codespaces/creating-a-codespace-for-a-repository)"
- "[The codespace lifecycle](/codespaces/developing-in-codespaces/the-codespace-lifecycle)"
- "[Using source control in your codespace](/codespaces/developing-in-codespaces/using-source-control-in-your-codespace)"

View File

@@ -1,6 +1,6 @@
---
title: Deleting a codespace
intro: You can delete a codespace you no longer need.
title: 删除代码空间
intro: 您可以删除不再需要的代码空间。
redirect_from:
- /github/developing-online-with-github-codespaces/deleting-a-codespace
- /github/developing-online-with-codespaces/deleting-a-codespace
@@ -13,28 +13,33 @@ topics:
- Fundamentals
- Developer
shortTitle: Delete a codespace
ms.openlocfilehash: c9f1f6eb407c985d8981504de28e39a4bf742f7a
ms.sourcegitcommit: e8c012864f13f9146e53fcb0699e2928c949ffa8
ms.translationtype: HT
ms.contentlocale: zh-CN
ms.lasthandoff: 11/09/2022
ms.locfileid: '148158659'
---
You can delete a codespace in a variety of ways: in the terminal by using {% data variables.product.prodname_cli %}, in {% data variables.product.prodname_vscode %}, or in your web browser. Use the tabs in this article to display instructions for each of these ways of deleting a codespace.
可以通过多种方式删除 codespace在终端中使用 {% data variables.product.prodname_cli %}、在 {% data variables.product.prodname_vscode %} 中或在 Web 浏览器中。 使用本文中的选项卡可显示删除 codespace 的每种方法的说明。
{% note %}
**Note**: You can't delete a codespace from within the JetBrains Gateway, or the JetBrains client application, or from within JupyterLab.
注意:无法从 JetBrains 网关或 JetBrains 客户端应用程序或 JupyterLab 中删除 codespace。
{% endnote %}
There are costs associated with storing codespaces. You should therefore delete any codespaces you no longer need. For more information, see "[About billing for {% data variables.product.prodname_github_codespaces %}](/billing/managing-billing-for-github-codespaces/about-billing-for-github-codespaces)."
存储 codespace 会产生费用。 因此,应删除任何不再需要的 codespace。 有关详细信息,请参阅“[关于 {% data variables.product.prodname_github_codespaces %} 的计费](/billing/managing-billing-for-github-codespaces/about-billing-for-github-codespaces)”。
{% data reusables.codespaces.max-number-codespaces %}
## Deleting a codespace
## 删除代码空间
{% webui %}
{% data reusables.codespaces.your-codespaces-procedure-step %}
1. To the right of the codespace you want to delete, click {% octicon "kebab-horizontal" aria-label="The horizontal kebab icon" %}, then click **{% octicon "trash" aria-label="The trash icon" %} Delete**
1. 在要删除的代码空间的右侧,单击 {% octicon "kebab-horizontal" aria-label="The horizontal kebab icon" %},然后单击“{% octicon "trash" aria-label="The trash icon" %}删除”。
![Delete button](/assets/images/help/codespaces/delete-codespace.png)
![“删除”按钮](/assets/images/help/codespaces/delete-codespace.png)
{% endwebui %}
@@ -49,48 +54,48 @@ There are costs associated with storing codespaces. You should therefore delete
{% data reusables.cli.cli-learn-more %}
To delete a codespace use the `gh codespace delete` subcommand and then choose a codespace from the list that's displayed.
若要删除代码空间,请使用 `gh codespace delete` 子命令,然后从显示的列表中选择一个代码空间。
```shell
gh codespace delete
```
If you have unsaved changes, you'll be prompted to confirm deletion. You can use the `--force` flag to force deletion, avoiding this prompt.
如果您有未保存的更改,系统将提示您确认删除。 可以使用 `--force` 标志强制删除,从而避免出现此提示。
For more information about this command, see [the {% data variables.product.prodname_cli %} manual](https://cli.github.com/manual/gh_codespace_delete).
有关此命令的详细信息,请参阅 [{% data variables.product.prodname_cli %} 手册](https://cli.github.com/manual/gh_codespace_delete)
{% endcli %}
## Bulk deleting codespaces
## 批量删除 codespace
{% webui %}
You can use {% data variables.product.prodname_cli %} to delete several or all of your codespaces with a single command. For more information, click the "{% data variables.product.prodname_cli %}" tab near the top of this page.
可以使用 {% data variables.product.prodname_cli %} 通过单个命令删除多个或所有 codespace。 有关详细信息,请单击此页面顶部附近的“{% data variables.product.prodname_cli %}”选项卡。
{% endwebui %}
{% vscode %}
You can use {% data variables.product.prodname_cli %} to delete several or all of your codespaces with a single command. For more information, click the "{% data variables.product.prodname_cli %}" tab near the top of this page.
可以使用 {% data variables.product.prodname_cli %} 通过单个命令删除多个或所有 codespace。 有关详细信息,请单击此页面顶部附近的“{% data variables.product.prodname_cli %}”选项卡。
{% endvscode %}
{% cli %}
You can delete several or all of your codespaces with a single command, using `gh codespace delete` followed by one of these flags:
可以使用单个命令并在 `gh codespace delete` 后使用以下标志之一来删除多个或所有 codespace
`--all` - Delete all of your codespaces.
`--all` - 删除所有 codespace
`--repo REPOSITORY` - Delete all of your codespaces for this repository. Or use together with the `--days` flag to filter by age of the codespace.
`--repo REPOSITORY` - 删除此存储库的所有 codespace。 或者与 `--days` 标志一起使用,按 codespace 的存在时长进行筛选。
`--days NUMBER` - Delete all of your codespaces that are older than the specified number of days. Can be used together with the `--repo` flag.
`--days NUMBER` - 删除早于指定天数的所有 codespace。 可以与 `--repo` 标志一起使用。
By default you are prompted to confirm deletion of any codespaces that contain unsaved changes. You can use the `--force` flag to skip this confirmation.
默认情况下,系统会提示确认删除包含未保存更改的任何 codespace。 可以使用 `--force` 标志跳过此确认。
### Example
### 示例
Delete all of the codespaces for the `octo-org/octo-repo` repository that you created more than 7 days ago.
删除 `octo-org/octo-repo` 存储库 7 天前创建的所有 codespace。
```
gh codespace delete --repo octo-org/octo-repo --days 7
@@ -98,37 +103,37 @@ gh codespace delete --repo octo-org/octo-repo --days 7
{% endcli %}
## Deleting codespaces in your organization
## 删除组织中的 codespace
As an organization owner, you can use {% data variables.product.prodname_cli %} to delete any codespace in your organization.
作为组织所有者,可以使用 {% data variables.product.prodname_cli %} 删除组织中的任何 codespace。
{% webui %}
For more information, click the "{% data variables.product.prodname_cli %}" tab near the top of this page.
有关详细信息,请单击此页面顶部附近的“{% data variables.product.prodname_cli %}”选项卡。
{% endwebui %}
{% vscode %}
For more information, click the "{% data variables.product.prodname_cli %}" tab near the top of this page.
有关详细信息,请单击此页面顶部附近的“{% data variables.product.prodname_cli %}”选项卡。
{% endvscode %}
{% cli %}
1. Enter one of these commands to display a list of codespaces.
* `gh codespace delete --org ORGANIZATION` - Lists the current codespaces in the specified organization.
* `gh codespace delete --org ORGANIZATION --user USER` - Lists only those codespaces created by the specified user.
You must be an owner of the specified organization.
1. In the list of codespaces, navigate to the codespace you want to delete.
1. To delete the selected codespace press <kbd>Enter</kbd>.
1. 输入以下命令之一以显示 codespace 列表。
* `gh codespace delete --org ORGANIZATION` - 列出指定组织中的当前 codespace。
* `gh codespace delete --org ORGANIZATION --user USER` - 仅列出指定用户创建的 codespace。
你必须是指定组织的所有者。
1. 在 codespace 列表中,导航到要删除的 codespace。
1. 要删除选定的 codespace,请按 <kbd>Enter</kbd>
If the codespace contains unsaved changes you will be prompted to confirm deletion.
如果 codespace 包含未保存的更改,系统会提示确认删除。
{% endcli %}
You can also use the REST API to delete codespaces for your organization. For more information, see "[Codespaces organizations](/rest/codespaces/organizations#delete-a-codespace-from-the-organization)."
还可以使用 REST API 删除组织的 codespace。 有关详细信息,请参阅“[Codespaces 组织](/rest/codespaces/organizations#delete-a-codespace-from-the-organization)”。
## Further reading
- "[The codespace lifecycle](/codespaces/developing-in-codespaces/the-codespace-lifecycle)"
- "[Configuring automatic deletion of your codespaces](/codespaces/customizing-your-codespace/configuring-automatic-deletion-of-your-codespaces)"
## 延伸阅读
- [codespace 生命周期](/codespaces/developing-in-codespaces/the-codespace-lifecycle)
- [配置 codespace 的自动删除](/codespaces/customizing-your-codespace/configuring-automatic-deletion-of-your-codespaces)

View File

@@ -1,6 +1,6 @@
---
title: Developing in a codespace
intro: 'You can work in a codespace using your browser, {% data variables.product.prodname_vscode %}, a JetBrains IDE, or in a command shell.'
title: 在代码空间中开发
intro: '可以使用浏览器、{% data variables.product.prodname_vscode %}JetBrains IDE 或在命令 shell 中在 codespace 中工作。'
redirect_from:
- /github/developing-online-with-github-codespaces/developing-in-a-codespace
- /github/developing-online-with-codespaces/developing-in-a-codespace
@@ -13,127 +13,129 @@ topics:
- Fundamentals
- Developer
shortTitle: Develop in a codespace
ms.openlocfilehash: e941373ade8c2f8365e7b654733b7ee029a6a7dd
ms.sourcegitcommit: e8c012864f13f9146e53fcb0699e2928c949ffa8
ms.translationtype: HT
ms.contentlocale: zh-CN
ms.lasthandoff: 11/09/2022
ms.locfileid: '148159067'
---
{% jetbrains %}
{% data reusables.codespaces.codespaces-jetbrains-beta-note %}
{% endjetbrains %}
## About development with {% data variables.product.prodname_github_codespaces %}
## 关于使用 {% data variables.product.prodname_github_codespaces %} 进行开发
You can develop code in a codespace using your choice of tool:
可以使用所选工具在 codespace 中开发代码:
* A command shell, via an SSH connection initiated using {% data variables.product.prodname_cli %}.
* One of the JetBrains IDEs, via the JetBrains Gateway.
* The {% data variables.product.prodname_vscode %} desktop application.
* A browser-based version of {% data variables.product.prodname_vscode %}.
* 命令 shell通过使用 {% data variables.product.prodname_cli %} 启动的 SSH 连接。
* JetBrains IDE 之一,通过 JetBrains 网关。
* {% data variables.product.prodname_vscode %} 桌面应用程序。
* {% data variables.product.prodname_vscode %} 的基于浏览器的版本。
{% webui %}
The tabs in this article allow you to switch between information for each of these ways of working. You're currently on the tab for the web browser version of {% data variables.product.prodname_vscode %}.
使用本文中的选项卡,可以在每种工作方式的信息之间切换。 你当前位于 {% data variables.product.prodname_vscode %} 的 Web 浏览器版本的选项卡上。
## Working in a codespace in the browser
## 在浏览器的 codespace 中工作
Using {% data variables.product.prodname_codespaces %} in the browser provides you with a fully featured development experience. You can edit code, debug, use Git commands, and run your application.
在浏览器中使用 {% data variables.product.prodname_codespaces %} 可提供功能齐全的开发体验。 可以编辑代码、调试、使用 Git 命令以及运行应用程序。
![Annotated screenshot of a codespace in the browser](/assets/images/help/codespaces/codespace-overview-annotated.png)
![浏览器中 codespace 的带有批注的屏幕截图](/assets/images/help/codespaces/codespace-overview-annotated.png)
{% data reusables.codespaces.vscode-interface-annotation %}
{% data reusables.codespaces.use-chrome %} For more information, see "[Troubleshooting {% data variables.product.prodname_github_codespaces %} clients](/codespaces/troubleshooting/troubleshooting-github-codespaces-clients)."
{% data reusables.codespaces.developing-in-vscode %}
{% data reusables.codespaces.navigating-to-a-codespace %}
{% data reusables.codespaces.vscode-interface-annotation %} {% data reusables.codespaces.use-chrome %} 有关详细信息,请参阅“[对 {% data variables.product.prodname_github_codespaces %} 客户端进行故障排除](/codespaces/troubleshooting/troubleshooting-github-codespaces-clients)”。
{% data reusables.codespaces.developing-in-vscode %} {% data reusables.codespaces.navigating-to-a-codespace %}
{% endwebui %}
{% vscode %}
The tabs in this article allow you to switch between information for each of these ways of working. You're currently on the tab for {% data variables.product.prodname_vscode %}.
使用本文中的选项卡,可以在每种工作方式的信息之间切换。 你当前位于 {% data variables.product.prodname_vscode %} 的选项卡上。
## Working in a codespace in {% data variables.product.prodname_vscode_shortname %}
## {% data variables.product.prodname_vscode_shortname %} 的 codespace 中工作
{% data variables.product.prodname_github_codespaces %} provides you with the full development experience of {% data variables.product.prodname_vscode %}. {% data reusables.codespaces.use-visual-studio-features %}
{% data variables.product.prodname_github_codespaces %} 为你提供完整的 {% data variables.product.prodname_vscode %} 开发体验。 {% data reusables.codespaces.use-visual-studio-features %}
![Annotated screenshot of a codespace in VS Code](/assets/images/help/codespaces/codespace-annotated-vscode.png)
![VS Code 中 codespace 的带批注的屏幕截图](/assets/images/help/codespaces/codespace-annotated-vscode.png)
{% data reusables.codespaces.vscode-interface-annotation %}
For more information on using {% data variables.product.prodname_vscode_shortname %}, see the [User Interface guide](https://code.visualstudio.com/docs/getstarted/userinterface) in the {% data variables.product.prodname_vscode_shortname %} documentation.
有关使用 {% data variables.product.prodname_vscode_shortname %} 的详细信息,请参阅 {% data variables.product.prodname_vscode_shortname %} 文档中的[用户界面指南](https://code.visualstudio.com/docs/getstarted/userinterface)
{% data reusables.codespaces.connect-to-codespace-from-vscode %}
For troubleshooting information, see "[Troubleshooting Codespaces clients](/codespaces/troubleshooting/troubleshooting-github-codespaces-clients)."
{% data reusables.codespaces.developing-in-vscode %}
{% data reusables.codespaces.navigating-to-a-codespace %}
有关故障排除信息,请参阅“[ Codespaces 客户端进行故障排除](/codespaces/troubleshooting/troubleshooting-github-codespaces-clients)”。
{% data reusables.codespaces.developing-in-vscode %} {% data reusables.codespaces.navigating-to-a-codespace %}
{% endvscode %}
{% jetbrains %}
The tabs in this article allow you to switch between information for each of these ways of working. You're currently on the tab for JetBrains IDEs.
使用本文中的选项卡,可以在每种工作方式的信息之间切换。 你当前位于 JetBrains IDE 的选项卡上。
## Working in a codespace in a JetBrains IDE
## 在 JetBrains IDE 中的 codespace 中工作
To use {% data variables.product.prodname_github_codespaces %} with a JetBrains IDE you must have already installed JetBrains Gateway. For information about installing JetBrains Gateway, see [the JetBrains website](https://www.jetbrains.com/remote-development/gateway/).
要将 {% data variables.product.prodname_github_codespaces %} JetBrains IDE 一起使用,必须已安装 JetBrains 网关。 有关安装 JetBrains 网关的信息,请参阅 [JetBrains 网站](https://www.jetbrains.com/remote-development/gateway/)
You can work in a codespace using your choice of JetBrains IDE. After creating a codespace, you can use the JetBrains Gateway application to open the codespace in your preferred IDE.
可以使用所选的 JetBrains IDE 在 codespace 中工作。 创建 codespace 后,可以使用 JetBrains 网关应用程序在首选 IDE 中打开 codespace。
You can edit code, debug, and use Git commands while developing in a codespace with your JetBrains IDE. For more information about the various JetBrains IDEs, see the [JetBrains documentation](https://www.jetbrains.com/help/).
使用 JetBrains IDE 在 codespace 中进行开发时,可以编辑代码、调试和使用 Git 命令。 有关各种 JetBrains IDE 的详细信息,请参阅 [JetBrains 文档](https://www.jetbrains.com/help/)
### IntelliJ IDEA user interface
### IntelliJ IDEA 用户界面
Within the {% data variables.product.prodname_github_codespaces %} documentation we use IntelliJ IDEA as a representative JetBrains IDE. Different JetBrains IDEs may have different layouts.
{% data variables.product.prodname_github_codespaces %} 文档中,我们使用 IntelliJ IDEA 作为具有代表性的 JetBrains IDE。 不同的 JetBrains IDE 可能具有不同的布局。
![Annotated screenshot of a codespace in JetBrains IntelliJ IDEA](/assets/images/help/codespaces/jetbrains-gui-with-callouts.png)
![JetBrains IntelliJ IDEA 中 codespace 的带批注的屏幕截图](/assets/images/help/codespaces/jetbrains-gui-with-callouts.png)
1. **Navigation bar** - This displays the path to the currently selected file or directory. Use the buttons to the right of the navigation bar to perform various actions, including building, running, or debugging the project, or running Git commands to commit and push your changes.
2. **Project tool window** - This shows you the structure of your project and allows you to open files in the editor.
3. **{% data variables.product.prodname_github_codespaces %} tool window** - This is displayed by clicking the {% data variables.product.prodname_github_codespaces %} plugin in the bar to the left of the tool window. It displays information about your codespace, including its display name and machine type. The buttons at the top of this tool window allow you to:
* Stop the codespace and disconnect
* Display the "Your codespaces" web page
* View the codespace creation logs
* Rebuild the dev container
4. **Editor** - This is where you edit your files. You can right-click the tab for a file to access options such as moving the tab to a new window.
5. **Terminal** - This is displayed by clicking **Terminal** in the tool window bar at the bottom of the main window (just above the status bar). The integrated terminal allows you to perform command-line tasks without having to switch to a dedicated terminal application.
6. **Status bar** - Hover over the icon at the left of the status bar to see a list of tools. Click the icon to hide or show the tool window bars. The right side of the status bar shows information about the project, including the current Git branch.
1. **导航栏** - 显示当前所选文件或目录的路径。 使用导航栏右侧的按钮执行各种操作,包括生成、运行或调试项目,或者运行 Git 命令以提交和推送更改。
2. **项目工具窗口** - 显示项目的结构,并允许在编辑器中打开文件。
3. **{% data variables.product.prodname_github_codespaces %} 工具窗口** - 单击工具窗口左侧栏中的 {% data variables.product.prodname_github_codespaces %} 插件即可显示。 它显示有关 codespace 的信息,包括其显示名称和计算机类型。 此工具窗口顶部的按钮可用于:
* 停止 codespace 并断开连接
* 显示“你的 codespace”网页
* 查看 codespace 创建日志
* 重新生成开发容器
4. **编辑器** - 这是编辑文件的地方。 可以右键单击文件的选项卡以访问选项,例如将选项卡移动到新窗口。
5. **终端** - 单击主窗口底部的工具窗口栏中的“终端”(状态栏正上方),即可显示。 通过集成终端,无需切换到专用终端应用程序即可执行命令行任务。
6. **状态栏** - 将鼠标悬停在状态栏左侧的图标上可查看工具列表。 单击图标可隐藏或显示工具窗口栏。 状态栏的右侧显示有关项目的信息,包括当前 Git 分支。
For more information about the IntelliJ IDEA user interface, see the [JetBrains documentation for IntelliJ IDEA](https://www.jetbrains.com/help/idea/guided-tour-around-the-user-interface.html).
有关 IntelliJ IDEA 用户界面的详细信息,请参阅 [IntelliJ IDEA 的 JetBrains 文档](https://www.jetbrains.com/help/idea/guided-tour-around-the-user-interface.html)
### Customizing the codespaces for a repository
### 自定义存储库的 codespace
You can customize the codespaces that are created for a repository by creating or updating the dev container configuration for the repository. You can do this from within a codespace. After you change a dev container configuration, you can apply the changes to the current codespace by rebuilding the Docker container for the codespace. For more information, see "[Introduction to dev containers](/codespaces/setting-up-your-project-for-codespaces/introduction-to-dev-containers)."
可以通过创建或更新存储库的开发容器配置来自定义为存储库创建的 codespace。 可以从 codespace 中执行此操作。 更改开发容器配置后,可以通过为 codespace 重新生成 Docker 容器来将更改应用于当前 codespace。 有关详细信息,请参阅“[开发容器简介](/codespaces/setting-up-your-project-for-codespaces/introduction-to-dev-containers)”。
### Personalizing your codespace
### 个性化代码空间
You can use a [dotfiles](https://dotfiles.github.io/tutorials/) repository to personalize aspects of the codespace environment for any codespace that you create. For more information, see "[Personalizing {% data variables.product.prodname_github_codespaces %} for your account](/codespaces/customizing-your-codespace/personalizing-github-codespaces-for-your-account#dotfiles)."
可以使用 [dotfiles](https://dotfiles.github.io/tutorials/) 存储库为创建的任何 codespace 个性化 codespace 环境的各个方面。 有关详细信息,请参阅“[为帐户设置个性化的 {% data variables.product.prodname_github_codespaces %}](/codespaces/customizing-your-codespace/personalizing-github-codespaces-for-your-account#dotfiles)”。
### Committing your changes
### 提交更改
Once you've made changes to your codespace, either new code or configuration changes, you'll want to commit and push your changes. Pushing changes to a repository ensures that anyone else who creates a codespace from this repository has the same configuration. This also means that any customization you do, to modify the configuration of codespaces created for a repository, will be available to everybody who uses the repository.
在对 codespace 进行更改(无论是添加新代码还是更改配置)之后,需要提交和推送更改。 将更改推送到存储库可确保从此存储库创建 codespace 的其他任何人都具有相同的配置。 这也意味着,为修改为存储库创建的 codespace 的配置所做的任何自定义都将可供使用该存储库的所有人使用。
For more information, see "[Using source control in your codespace](/codespaces/developing-in-codespaces/using-source-control-in-your-codespace#committing-your-changes)."
有关详细信息,请参阅[ codespace 中使用源代码管理](/codespaces/developing-in-codespaces/using-source-control-in-your-codespace#committing-your-changes)
## Further reading
## 延伸阅读
* "[Using {% data variables.product.prodname_github_codespaces %} in your JetBrains IDE](/codespaces/developing-in-codespaces/using-github-codespaces-in-your-jetbrains-ide)"
* "[Using the {% data variables.product.prodname_github_codespaces %} plugin for JetBrains](/codespaces/codespaces-reference/using-the-github-codespaces-plugin-for-jetbrains)"
* "[Troubleshooting {% data variables.product.prodname_github_codespaces %} clients](/codespaces/troubleshooting/troubleshooting-github-codespaces-clients)"
* [在 JetBrains IDE 中使用 {% data variables.product.prodname_github_codespaces %}](/codespaces/developing-in-codespaces/using-github-codespaces-in-your-jetbrains-ide)”。
* [ {% data variables.product.prodname_github_codespaces %} 插件用于 JetBrains](/codespaces/codespaces-reference/using-the-github-codespaces-plugin-for-jetbrains)
* [ {% data variables.product.prodname_github_codespaces %} 客户端进行故障排除](/codespaces/troubleshooting/troubleshooting-github-codespaces-clients)
{% endjetbrains %}
{% cli %}
The tabs in this article allow you to switch between information for each of these ways of working. You're currently on the tab for {% data variables.product.prodname_cli %}.
使用本文中的选项卡,可以在每种工作方式的信息之间切换。 当前位于 {% data variables.product.prodname_cli %} 的选项卡上。
## Working in a codespace in a command shell
## 在命令 shell 中的 codespace 中工作
{% data reusables.cli.cli-learn-more %}
You can use {% data variables.product.prodname_cli %} to create a new codespace, or start an existing codespace, and then SSH to it. Once connected, you can work on the command line using your preferred command-line tools.
可以使用 {% data variables.product.prodname_cli %} 创建新的 codespace或启动现有 codespace然后通过 SSH 连接到它。 连接后,可以使用你喜欢的命令行工具在命令行上工作。
After installing {% data variables.product.prodname_cli %} and authenticating with your {% data variables.product.prodname_dotcom %} account you can use the command `gh codespace [<SUBCOMMAND>...] --help` to browse the help information. Alternatively, you can view the same reference information at [https://cli.github.com/manual/gh_codespace](https://cli.github.com/manual/gh_codespace).
安装 {% data variables.product.prodname_cli %} 并对 {% data variables.product.prodname_dotcom %} 帐户进行身份验证后,可以使用命令 `gh codespace [<SUBCOMMAND>...] --help` 浏览帮助信息。 或者,可以通过 [https://cli.github.com/manual/gh_codespace](https://cli.github.com/manual/gh_codespace) 查看相同的参考信息。
For more information, see "[Using {% data variables.product.prodname_github_codespaces %} with GitHub CLI](/codespaces/developing-in-codespaces/using-github-codespaces-with-github-cli)."
有关详细信息,请参阅“[ {% data variables.product.prodname_github_codespaces %} GitHub CLI 结合使用](/codespaces/developing-in-codespaces/using-github-codespaces-with-github-cli)”。
{% endcli %}

View File

@@ -1,5 +1,5 @@
---
title: Forwarding ports in your codespace
title: 代码空间中的转发端口
intro: '{% data reusables.codespaces.about-port-forwarding %}'
versions:
fpt: '*'
@@ -12,76 +12,77 @@ topics:
- Fundamentals
- Developer
shortTitle: Forward ports
ms.openlocfilehash: 320a2e42d647452056961d4f0f987c3c5db49476
ms.sourcegitcommit: e8c012864f13f9146e53fcb0699e2928c949ffa8
ms.translationtype: HT
ms.contentlocale: zh-CN
ms.lasthandoff: 11/09/2022
ms.locfileid: '148158907'
---
{% jetbrains %}
{% data reusables.codespaces.codespaces-jetbrains-beta-note %}
{% endjetbrains %}
## About forwarded ports
## 关于转发的端口
Port forwarding gives you access to TCP ports running within your codespace. For example, if you're running a web application on a particular port in your codespace, you can forward that port. This allows you to access the application from the browser on your local machine for testing and debugging.
通过端口转发,您可以访问在代码空间内运行的 TCP 端口。 例如,如果要在代码空间中的特定端口上运行 Web 应用程序,则可以转发该端口。 这允许您从本地计算机上的浏览器访问应用程序以进行测试和调试。
{% webui %}
{% data reusables.codespaces.port-forwarding-intro-non-jetbrains %}
{% data reusables.codespaces.navigate-to-ports-tab %}
1. Under the list of ports, click **Add port**.
{% data reusables.codespaces.port-forwarding-intro-non-jetbrains %} {% data reusables.codespaces.navigate-to-ports-tab %}
1. 在端口列表下,单击“添加端口”。
![Add port button](/assets/images/help/codespaces/add-port-button.png)
![添加端口按钮](/assets/images/help/codespaces/add-port-button.png)
1. Type the port number or address, then press enter.
1. 键入端口编号或地址,然后按 Enter
![Text box to type port button](/assets/images/help/codespaces/port-number-text-box.png)
![输入端口按钮的文本框](/assets/images/help/codespaces/port-number-text-box.png)
## Using HTTPS forwarding
## 使用 HTTPS 转发
By default, {% data variables.product.prodname_github_codespaces %} forwards ports using HTTP but you can update any port to use HTTPS, as needed. If you update a port with public visibility to use HTTPS, the port's visibility will automatically change to private.
默认情况下,{% data variables.product.prodname_github_codespaces %} 使用 HTTP 转发端口,但你可以根据需要更新任何端口以使用 HTTPS。 如果将具有公共可见性的端口更新为使用 HTTPS则该端口的可见性将自动更改为专用。
{% data reusables.codespaces.navigate-to-ports-tab %}
1. Right click the port you want to update, then hover over **Change Port Protocol**.
![Option to change port protocol](/assets/images/help/codespaces/update-port-protocol.png)
1. Select the protocol needed for this port. The protocol that you select will be remembered for this port for the lifetime of the codespace.
1. 右键单击要更新的端口,然后单击“更改端口协议”。
![更改端口协议的选项](/assets/images/help/codespaces/update-port-protocol.png)
1. 选择此端口所需的协议。 您选择的协议将在代码空间的有效期内被记住用于此端口。
{% data reusables.codespaces.port-forwarding-sharing-non-jetbrains %}
{% data reusables.codespaces.navigate-to-ports-tab %}
1. Right click the port that you want to share, select the "Port Visibility" menu, then click **Private to Organization** or **Public**.
![Option to select port visibility in right-click menu](/assets/images/help/codespaces/make-public-option.png)
1. To the right of the local address for the port, click the copy icon.
![Copy icon for port URL](/assets/images/help/codespaces/copy-icon-port-url.png)
1. Send the copied URL to the person you want to share the port with.
1. 右键单击要共享的端口,选择“端口可见性”菜单,然后单击“专用于组织”或“公共” 。
![用于在右键单击菜单中选择端口可见性的选项](/assets/images/help/codespaces/make-public-option.png)
1. 在端口的本地地址右侧,单击复制图标。
![端口 URL 的复制图标](/assets/images/help/codespaces/copy-icon-port-url.png)
1. 将复制的 URL 发送给您想要与其共享端口的人。
{% data reusables.codespaces.port-forwarding-labeling-non-jetbrains %}
{% data reusables.codespaces.port-forwarding-adding-non-jetbrains %}
{% data reusables.codespaces.port-forwarding-labeling-non-jetbrains %} {% data reusables.codespaces.port-forwarding-adding-non-jetbrains %}
{% endwebui %}
{% vscode %}
{% data reusables.codespaces.port-forwarding-intro-non-jetbrains %}
{% data reusables.codespaces.navigate-to-ports-tab %}
1. Under the list of ports, click **Add port**.
{% data reusables.codespaces.port-forwarding-intro-non-jetbrains %} {% data reusables.codespaces.navigate-to-ports-tab %}
1. 在端口列表下,单击“添加端口”。
![Add port button](/assets/images/help/codespaces/add-port-button.png)
![添加端口按钮](/assets/images/help/codespaces/add-port-button.png)
1. Type the port number or address, then press enter.
1. 键入端口编号或地址,然后按 Enter
![Text box to type port button](/assets/images/help/codespaces/port-number-text-box.png)
![输入端口按钮的文本框](/assets/images/help/codespaces/port-number-text-box.png)
{% data reusables.codespaces.port-forwarding-sharing-non-jetbrains %}
{% data reusables.codespaces.navigate-to-ports-tab %}
1. Right click the port that you want to share, select the "Port Visibility" menu, then click **Private to Organization** or **Public**.
![Option to make port public in right-click menu](/assets/images/help/codespaces/make-public-option.png)
1. To the right of the local address for the port, click the copy icon.
![Copy icon for port URL](/assets/images/help/codespaces/copy-icon-port-url.png)
1. Send the copied URL to the person you want to share the port with.
1. 右键单击要共享的端口,选择“端口可见性”菜单,然后单击“专用于组织”或“公共” 。
![右键菜单中公开端口的选项](/assets/images/help/codespaces/make-public-option.png)
1. 在端口的本地地址右侧,单击复制图标。
![端口 URL 的复制图标](/assets/images/help/codespaces/copy-icon-port-url.png)
1. 将复制的 URL 发送给您想要与其共享端口的人。
{% data reusables.codespaces.port-forwarding-labeling-non-jetbrains %}
{% data reusables.codespaces.port-forwarding-adding-non-jetbrains %}
{% data reusables.codespaces.port-forwarding-labeling-non-jetbrains %} {% data reusables.codespaces.port-forwarding-adding-non-jetbrains %}
{% endvscode %}
@@ -90,37 +91,37 @@ By default, {% data variables.product.prodname_github_codespaces %} forwards por
{% data reusables.cli.cli-learn-more %}
To forward a port use the `gh codespace ports forward` subcommand. Replace `codespace-port:local-port` with the remote and local ports that you want to connect. After entering the command choose from the list of codespaces that's displayed.
若要转发端口,请使用 `gh codespace ports forward` 子命令。 将 `codespace-port:local-port` 替换为要连接的远程端口和本地端口。 输入命令后,从显示的代码空间列表中进行选择。
```shell
gh codespace ports forward CODESPACE-PORT:LOCAL-PORT
```
For more information about this command, see [the {% data variables.product.prodname_cli %} manual](https://cli.github.com/manual/gh_codespace_ports_forward).
有关此命令的详细信息,请参阅 [{% data variables.product.prodname_cli %} 手册](https://cli.github.com/manual/gh_codespace_ports_forward)
To see details of forwarded ports enter `gh codespace ports` and then choose a codespace.
若要查看转发端口的详细信息,请输入 `gh codespace ports` 并选择 codespace
{% data reusables.codespaces.port-forwarding-sharing-non-jetbrains %}
To change the visibility of a forwarded port, use the `gh codespace ports visibility` subcommand. {% data reusables.codespaces.port-visibility-settings %}
若要更改转发端口的可见性,请使用 `gh codespace ports visibility` 子命令。 {% data reusables.codespaces.port-visibility-settings %}
Replace `codespace-port` with the forwarded port number. Replace `setting` with `private`, `org`, or `public`. After entering the command choose from the list of codespaces that's displayed.
`codespace-port` 替换为转发的端口号。 将 `setting` 替换为 `private``org` `public`。 输入命令后,从显示的代码空间列表中进行选择。
```shell
gh codespace ports visibility CODESPACE-PORT:SETTINGS
```
You can set the visibility for multiple ports with one command. For example:
您可以使用一个命令设置多个端口的可见性。 例如:
```shell
gh codespace ports visibility 80:private 3000:public 3306:org
```
For more information about this command, see [the {% data variables.product.prodname_cli %} manual](https://cli.github.com/manual/gh_codespace_ports_visibility).
有关此命令的详细信息,请参阅 [{% data variables.product.prodname_cli %} 手册](https://cli.github.com/manual/gh_codespace_ports_visibility)
{% data reusables.codespaces.port-forwarding-labeling-non-jetbrains %}
You can see the port labels when you list the forwarded ports for a codespace. To do this, use the `gh codespace ports` command and then select a codespace.
列出 codespace 的转发端口时,可以看到端口标签。 为此,请使用 `gh codespace ports` 命令,然后选择 codespace
{% data reusables.codespaces.port-forwarding-adding-non-jetbrains %}
@@ -128,10 +129,10 @@ You can see the port labels when you list the forwarded ports for a codespace. T
{% jetbrains %}
## Forwarding a port
## 转发端口
For information on how to forward a port in a codespace to a port on your local machine, see the "Port forwarding" section of the "[Security model](https://www.jetbrains.com/help/idea/security-model.html#port_forwarding)" article in the JetBrains documentation.
若要了解如何将 codespace 中的端口转发到本地计算机上的端口的信息,请参阅 JetBrains 文档中“[安全模型](https://www.jetbrains.com/help/idea/security-model.html#port_forwarding)”一文的“端口转发”部分。
Alternatively, you can use {% data variables.product.prodname_cli %} to forward a port. For more information, click the "{% data variables.product.prodname_cli %}" tab at the top of this page.
或者,可以使用 {% data variables.product.prodname_cli %} 转发端口。 有关详细信息,请单击此页面顶部附近的“{% data variables.product.prodname_cli %}”选项卡。
{% endjetbrains %}

View File

@@ -0,0 +1,108 @@
---
title: 用于机器学习的 GitHub Codespaces 入门
shortTitle: Machine learning
intro: '了解如何使用 {% data variables.product.prodname_github_codespaces %} 及其现成工具处理机器学习项目。'
versions:
fpt: '*'
ghec: '*'
type: tutorial
topics:
- Codespaces
- Developer
ms.openlocfilehash: 905d5b14bfba5e47d1fdfdd7f0be75b16750652d
ms.sourcegitcommit: e8c012864f13f9146e53fcb0699e2928c949ffa8
ms.translationtype: HT
ms.contentlocale: zh-CN
ms.lasthandoff: 11/09/2022
ms.locfileid: '148158915'
---
## 简介
本指南介绍使用 {% data variables.product.prodname_github_codespaces %} 进行机器学习。 你将生成简单的图像分类器,了解 {% data variables.product.prodname_github_codespaces %} 中预安装的一些工具,为 NVIDIA CUDA 配置开发环境,并在 JupyterLab 中打开 codespace。
## 生成简单的图像分类器
我们将使用 Jupyter 笔记本生成简单的图像分类器。
Jupyter 笔记本是一组可以逐个执行的单元。 我们将使用的笔记本包括许多单元,它们使用 [PyTorch](https://pytorch.org/) 生成图像分类器。 每个单元都是该过程的不同阶段:下载数据集,设置神经网络,训练模型,然后测试该模型。
我们将按顺序运行所有单元,以执行生成图像分类器的所有阶段。 当我们执行此操作时Jupyter 会将输出保存回笔记本,以便可以检查结果。
### 创建 codespace
1. 转到 [github/codespaces-jupyter](https://github.com/github/codespaces-jupyter) 模板存储库。
{% data reusables.codespaces.open-template-in-codespace-step %}
此模板的 codespace 会在基于 Web 的 {% data variables.product.prodname_vscode %} 版本中打开。
### 打开图像分类器笔记本
{% data variables.product.prodname_github_codespaces %} 使用的默认容器映像包括一组预安装在 codespace 中的机器学习库。 例如Numpy、pandas、SciPy、Matplotlib、seaborn、scikit-learn、Keras、PyTorch、Requests 和 Plotly。 有关默认映像的详细信息,请参阅“[开发容器简介](/codespaces/setting-up-your-project-for-codespaces/introduction-to-dev-containers#using-the-default-dev-container-configuration)”和 [`devcontainers/images` 存储库](https://github.com/devcontainers/images/tree/main/src/universal)。
1. 在 {% data variables.product.prodname_vscode_shortname %} 编辑器中,关闭显示的任何“入门”选项卡。
1. 打开 `notebooks/image-classifier.ipynb` 笔记本文件。
### 生成图像分类器
图像分类器笔记本包含下载数据集、训练神经网络以及评估其性能所需的所有代码。
1. 单击“全部运行”以执行所有笔记本单元。
![“全部运行”按钮的屏幕截图](/assets/images/help/codespaces/jupyter-run-all.png)
1. 向下滚动以查看每个单元的输出。
![编辑器中步骤 3 的屏幕截图](/assets/images/help/codespaces/jupyter-notebook-step3.png)
## 为 codespace 配置 NVIDIA CUDA
某些软件要求安装 NVIDIA CUDA 才能使用 codespace 的 GPU。 在这种情况下,可以使用 `devcontainer.json` 文件创建自己的自定义配置,并指定应安装 CUDA。 有关创建自定义配置的详细信息,请参阅“[开发容器简介](/codespaces/setting-up-your-project-for-codespaces/introduction-to-dev-containers#creating-a-custom-dev-container-configuration)”。
{% note %}
注意:有关在添加 `nvidia-cuda` 功能时运行的脚本的完整详细信息,请参阅 [devcontainers/features 存储库](https://github.com/devcontainers/features/tree/main/src/nvidia-cuda)。
{% endnote %}
1. 在 cpdespace 内的编辑器中打开 `.devcontainer/devcontainer.json` 文件。
1. 添加包含以下内容的顶级 `features` 对象:
```json{:copy}
"features": {
"ghcr.io/devcontainers/features/nvidia-cuda:1": {
"installCudnn": true
}
}
```
有关 `features` 对象的详细信息,请参阅[开发容器规范](https://containers.dev/implementors/features/#devcontainer-json-properties)。
如果使用为本教程创建的图像分类器存储库中的 `devcontainer.json` 文件,则 `devcontainer.json` 文件现在会如下所示:
```json
{
"customizations": {
"vscode": {
"extensions": [
"ms-python.python",
"ms-toolsai.jupyter"
]
}
},
"features": {
"ghcr.io/devcontainers/features/nvidia-cuda:1": {
"installCudnn": true
}
}
}
```
1. 保存更改。
{% data reusables.codespaces.rebuild-command %}将重新生成 codespace 容器。 这需要几分钟。 重新生成完成后codespace 会自动重新打开。
1. 将更改发布到存储库,以便在将来从此存储库创建的任何新 codespace 中安装 CUDA。 有关详细信息,请参阅“[通过模板创建 codespace](/codespaces/developing-in-codespaces/creating-a-codespace-from-a-template#publishing-from-vs-code)”。
## 在 JupyterLab 中打开 codespace
可以在 JupyterLab ([github.com/codespaces](https://github.com/codespaces)) 的“你的 codespace”页或使用 {% data variables.product.prodname_cli %} 打开 codespace。 有关详细信息,请参阅“[打开现有 codespace](/codespaces/developing-in-codespaces/opening-an-existing-codespace)”。
{% data reusables.codespaces.jupyterlab-installed-in-codespace %}

View File

@@ -1,6 +1,6 @@
---
title: Opening an existing codespace
intro: 'You can reopen a codespace that you have closed or stopped and return to your work.'
title: 打开现有 codespace
intro: 可以重新打开已关闭或已停止的 codespace 并返回到工作。
versions:
fpt: '*'
ghec: '*'
@@ -10,46 +10,51 @@ topics:
- Fundamentals
- Developer
shortTitle: Open an existing codespace
ms.openlocfilehash: e7a35c1a7b3a251094bf69fcd401291b69d03eae
ms.sourcegitcommit: e8c012864f13f9146e53fcb0699e2928c949ffa8
ms.translationtype: HT
ms.contentlocale: zh-CN
ms.lasthandoff: 11/09/2022
ms.locfileid: '148159003'
---
{% jetbrains %}
{% data reusables.codespaces.codespaces-jetbrains-beta-note %}
{% endjetbrains %}
You can reopen any of your active or stopped codespaces on {% data variables.product.prodname_dotcom_the_website %}, in a JetBrains IDE, in {% data variables.product.prodname_vscode %}, or by using {% data variables.product.prodname_cli %}. You can't reopen a codespace that has been deleted. For more information, see "[The codespace lifecycle](/codespaces/developing-in-codespaces/the-codespace-lifecycle)."
您可以在 {% data variables.product.prodname_dotcom_the_website %}JetBrains IDE 中、{% data variables.product.prodname_vscode %} 中或使用 {% data variables.product.prodname_cli %} 重新打开任何活动或已停止的代码空间。 无法重新打开已删除的 codespace。 有关详细信息,请参阅“[codespace 生命周期](/codespaces/developing-in-codespaces/the-codespace-lifecycle)”。
You can view all your codespaces on the "Your codespaces" page at [github.com/codespaces](https://github.com/codespaces). From this page, you can:
可以在“你的 codespace”页 ([github.com/codespaces](https://github.com/codespaces)) 上查看所有 codespace。 在此页中,可以:
- Open, stop, or delete your codespaces.
- See who owns (and may be billed for) your codespaces: your personal account, or organizations you belong to. For more information, see "[About billing for {% data variables.product.prodname_github_codespaces %}](/billing/managing-billing-for-github-codespaces/about-billing-for-github-codespaces)."
- Create a new codespace, either by choosing one of {% data variables.product.company_short %}'s templates or by clicking **New codespace**. For more information, see "[Creating a codespace from a template](/codespaces/developing-in-codespaces/creating-a-codespace-from-a-template)" and "[Creating a codespace for a repository](/codespaces/developing-in-codespaces/creating-a-codespace-for-a-repository)."
- 打开、停止或删除 codespace
- 了解谁拥有 codespace并可能为 codespace 付费):你的个人帐户或你所属的组织。 有关详细信息,请参阅“[关于 {% data variables.product.prodname_github_codespaces %} 的计费](/billing/managing-billing-for-github-codespaces/about-billing-for-github-codespaces)”。
- 通过选择 {% data variables.product.company_short %} 模板之一或单击“新建 codespace”来创建新的 codespace。 有关详细信息,请参阅“[从模板创建 codespace](/codespaces/developing-in-codespaces/creating-a-codespace-from-a-template)”和“[为存储库创建 codespace](/codespaces/developing-in-codespaces/creating-a-codespace-for-a-repository)”。
## Opening an existing codespace
## 打开现有 codespace
{% webui %}
{% data reusables.codespaces.your-codespaces-procedure-step %}
1. To open a codespace in your default editor, click the name of the codespace. {% data reusables.codespaces.about-changing-default-editor %} For more information, see "[Setting your default editor for {% data variables.product.prodname_github_codespaces %}](/codespaces/customizing-your-codespace/setting-your-default-editor-for-github-codespaces)."
1. 要在默认编辑器中打开 codespace请单击 codespace 的名称。 {% data reusables.codespaces.about-changing-default-editor %}有关详细信息,请参阅“[设置 {% data variables.product.prodname_github_codespaces %} 的默认编辑器](/codespaces/customizing-your-codespace/setting-your-default-editor-for-github-codespaces)”。
To open the codespace in an editor other than your default:
如需从非默认编辑器中打开 codespace请执行以下操作
1. Click the ellipsis (**...**) to the right of the codespace you want to open.
1. Click **Open in**.
1. Click **Open in APPLICATION**.
1. 单击要打开的 codespace 右侧的省略号 (...)。
1. 单击“在...中打开”。
1. 单击“在应用程序中打开”。
![Screenshot of the "Open in" dialog box, with "Open in Visual Studio Code" highlighted](/assets/images/help/codespaces/open-codespace-in-another-editor.png)
![“在...中打开”对话框的屏幕截图,其中突出显示“在 Visual Studio Code 中打开”](/assets/images/help/codespaces/open-codespace-in-another-editor.png)
You can open the codespace in:
* Your browser
可以在以下项中打开 codespace
* 浏览器
* {% data variables.product.prodname_vscode %}
* JetBrains Gateway
* JetBrains 网关
* JupyterLab
{% data reusables.codespaces.application-installed-locally %}
If you choose **JupyterLab**, the JupyterLab application must be installed in the codespace. {% data reusables.codespaces.jupyterlab-in-default-image %}
如果选择“JupyterLab”则必须在 codespace 中安装 JupyterLab 应用程序。 {% data reusables.codespaces.jupyterlab-in-default-image %}
{% endwebui %}
@@ -57,29 +62,28 @@ You can view all your codespaces on the "Your codespaces" page at [github.com/co
{% note %}
**Note:** {% data reusables.codespaces.using-codespaces-in-vscode %} For more information, see "[Using {% data variables.product.prodname_github_codespaces %} in {% data variables.product.prodname_vscode %}](/codespaces/developing-in-codespaces/using-github-codespaces-in-visual-studio-code)."
注意:{% data reusables.codespaces.using-codespaces-in-vscode %}有关详细信息,请参阅“[ {% data variables.product.prodname_vscode %} 中使用 {% data variables.product.prodname_github_codespaces %}](/codespaces/developing-in-codespaces/using-github-codespaces-in-visual-studio-code)”。
{% endnote %}
1. In the {% data variables.product.prodname_vscode_shortname %} desktop application, open the Command Palette with <kbd>Command</kbd>+<kbd>Shift</kbd>+<kbd>P</kbd> (Mac) or <kbd>Ctrl</kbd>+<kbd>Shift</kbd>+<kbd>P</kbd> (Windows/Linux).
1. Type "Codespaces" and select one of the following commands.
- To open a codespace in a new window of {% data variables.product.prodname_vscode_shortname %}, select **Codespaces: Open Codespace in New Window**
- To open a codespace in the web editor, select **Codespaces: Open in Browser**
1. Click the codespace that you want to open.
1. {% data variables.product.prodname_vscode_shortname %} 桌面应用程序中,使用 <kbd>Command</kbd>+<kbd>Shift</kbd>+<kbd>P</kbd> (Mac) <kbd>Ctrl</kbd>+<kbd>Shift</kbd>+<kbd>P</kbd> (Windows/Linux) 打开命令面板。
1. 键入“Codespaces”并选择以下命令之一。
- 要在 {% data variables.product.prodname_vscode_shortname %} 的新窗口中打开 codespace请选择“Codespaces: 在新窗口中打开 Codespace
- 要在 Web 编辑器中打开 codespace请选择“Codespaces: 在浏览器中打开”
1. 单击要打开的 codespace
![Screenshot of a list of codespaces in Visual Studio Code](/assets/images/help/codespaces/open-codespace-from-vscode.png)
![Visual Studio Code 中 codespace 列表的屏幕截图](/assets/images/help/codespaces/open-codespace-from-vscode.png)
You can also access the commands listed above by navigating to the Remote Explorer view in {% data variables.product.prodname_vscode_shortname %} and right-clicking the codespace that you want to open.
还可通过导航到 {% data variables.product.prodname_vscode_shortname %} 中的“远程资源管理器”视图并右键单击要打开的 codespace 来访问上面列出的命令。
![Screenshot of a codespace selected in the Remote Explorer, with "Open in Browser" highlighted](/assets/images/help/codespaces/open-codespace-remote-explorer.png)
![在“远程资源管理器”中选择的 codespace 的屏幕截图,其中突出显示了“在浏览器中打开”](/assets/images/help/codespaces/open-codespace-remote-explorer.png)
{% data reusables.codespaces.remote-explorer %}
{% endvscode %}
{% data reusables.codespaces.remote-explorer %} {% endvscode %}
{% cli %}
1. In a terminal, enter one of the following {% data variables.product.prodname_cli %} commands.
- To open a codespace in {% data variables.product.prodname_vscode_shortname %}, enter:
1. 在终端中,输入以下 {% data variables.product.prodname_cli %} 命令之一。
- 若要在 {% data variables.product.prodname_vscode_shortname %} 中删除 codespace请输入
```shell{:copy}
gh codespace code
@@ -87,17 +91,17 @@ You can also access the commands listed above by navigating to the Remote Explor
{% note %}
**Note**: You must have {% data variables.product.prodname_vscode_shortname %} installed on your local machine. For more information, see "[Setting up Visual Studio Code](https://code.visualstudio.com/docs/setup/setup-overview)" in the {% data variables.product.prodname_vscode_shortname %} documentation.
注意:必须在本地计算机上安装 {% data variables.product.prodname_vscode_shortname %}。 有关详细信息,请参阅 {% data variables.product.prodname_vscode_shortname %} 文档中的“[设置 Visual Studio Code](https://code.visualstudio.com/docs/setup/setup-overview)”。
{% endnote %}
- To open a codespace in the browser, enter:
- 若要在浏览器中打开 codespace,请输入:
```shell{:copy}
gh codespace code --web
```
- To open a codespace in JupyterLab, enter:
- 要在 JupyterLab 中打开 codespace请输入
```shell{:copy}
gh codespace code --jupyter
@@ -105,14 +109,14 @@ You can also access the commands listed above by navigating to the Remote Explor
{% note %}
**Note**: {% data reusables.codespaces.jupyterlab-installed-in-codespace %}
注意:{% data reusables.codespaces.jupyterlab-installed-in-codespace %}
{% endnote %}
1. Using the arrow keys, navigate to the codespace that you want to open.
1. To open the codespace, press <kbd>Enter</kbd>.
1. 使用箭头键导航到要打开的 codespace。
1. 若要打开 codespace请按 Enter<kbd></kbd>
For more information, see [`gh codespace code`](https://cli.github.com/manual/gh_codespace_code) in the {% data variables.product.prodname_cli %} manual.
有关详细信息,请参阅 {% data variables.product.prodname_cli %} 手册中的 [`gh codespace code`](https://cli.github.com/manual/gh_codespace_code)
{% endcli %}
@@ -120,4 +124,4 @@ For more information, see [`gh codespace code`](https://cli.github.com/manual/gh
{% data reusables.codespaces.opening-codespace-in-jetbrains %}
{% endjetbrains %}
{% endjetbrains %}

View File

@@ -1,6 +1,6 @@
---
title: Stopping and starting a codespace
intro: 'You can stop and start your codespace to save resources and to pause work.'
title: 停止和启动 codespace
intro: 可停止和启动 codespace 以保存资源和暂停工作。
versions:
fpt: '*'
ghec: '*'
@@ -10,28 +10,33 @@ topics:
- Fundamentals
- Developer
shortTitle: Stop a codespace
ms.openlocfilehash: 290a39d9d60420230bd9b11d5e2d10119ccc1c72
ms.sourcegitcommit: e8c012864f13f9146e53fcb0699e2928c949ffa8
ms.translationtype: HT
ms.contentlocale: zh-CN
ms.lasthandoff: 11/09/2022
ms.locfileid: '148158803'
---
{% jetbrains %}
{% data reusables.codespaces.codespaces-jetbrains-beta-note %}
{% endjetbrains %}
## About stopping and starting a codespace
## 关于停止和启动 codespace
{% data reusables.codespaces.stopping-a-codespace %}
Regardless of where you created or access your codespaces, you can view and manage them in your browser at https://github.com/codespaces.
无论在何处创建或访问 codespace都可以通过浏览器在 https://github.com/codespaces 中查看和管理它们。
## Stopping a codespace
## 停止代码空间
{% webui %}
{% data reusables.codespaces.navigate-to-codespaces-page %}
1. To the right of the codespace you want to stop, click the elipsis (**...**).
1. Click **Stop codespace**.
![Screenshot of option to stop a codespace](/assets/images/help/codespaces/stop-codespace-webui.png)
1. 单击要停止的 codespace 右侧的省略号 (...)。
1. 单击“停止 codespace”。
![用于停止 codespace 的选项的屏幕截图](/assets/images/help/codespaces/stop-codespace-webui.png)
{% endwebui %}
@@ -39,7 +44,7 @@ Regardless of where you created or access your codespaces, you can view and mana
{% data reusables.cli.cli-learn-more %}
To stop a codespace use the `gh codespace stop` subcommand and then choose the codespace you want to stop from the list that's displayed.
要停止 codespace,请使用 `gh codespace stop` 子命令,然后从显示的列表中选择该 codespace。
```shell{:copy}
gh codespace stop
@@ -50,41 +55,41 @@ Regardless of where you created or access your codespaces, you can view and mana
{% vscode %}
{% data reusables.vs-code.open-command-palette %}
1. Type `stop` and select **Codespaces: Stop Codespace** from the list of options.
1. In the list of codespaces, select the codespace you want to stop.
1. 键入 `stop` 并从选项列表中选择“Codespaces: 停止 Codespace”。
1. 在 codespace 列表中,选择要停止的 codespace。
{% endvscode %}
{% jetbrains %}
{% data reusables.codespaces.jetbrains-open-codespace-plugin %}
1. In the {% data variables.product.prodname_github_codespaces %} tool window, click the stop icon.
1. {% data variables.product.prodname_github_codespaces %} 工具窗口中,单击“停止”图标。
![Screenshot of the log button](/assets/images/help/codespaces/jetbrains-plugin-icon-stop.png)
![“日志”按钮的屏幕截图](/assets/images/help/codespaces/jetbrains-plugin-icon-stop.png)
{% endjetbrains %}
## Restarting a codespace
## 重启 codespace
{% webui %}
{% data reusables.codespaces.navigate-to-codespaces-page %}
1. Click the name of the codespace you want to restart.
![Screenshot of stopped codespaces](/assets/images/help/codespaces/restart-codespace-webui.png)
1. 单击要重启的 codespace 的名称。
![已停止的 codespace 的屏幕截图](/assets/images/help/codespaces/restart-codespace-webui.png)
{% endwebui %}
{% cli %}
When you restart a codespace you can choose to open it in {% data variables.product.prodname_vscode %} or in your browser.
重启 codespace 时,可选择在 {% data variables.product.prodname_vscode %} 或浏览器中将其打开。
- To restart a codespace and open it in {% data variables.product.prodname_vscode %}, use the `gh codespace code` subcommand and then choose the codespace you want to restart from the list that's displayed.
- 要重启 codespace 并在 {% data variables.product.prodname_vscode %} 中将其打开,请使用 `gh codespace code` 子命令,然后从显示的列表中选择要重启的 codespace。
```shell{:copy}
gh codespace code
```
- To restart a codespace and open it in your browser, use the `gh codespace open --web` subcommand and then choose the codespace you want to restart from the list that's displayed.
- 要重启 codespace 并在浏览器中将其打开,请使用 `gh codespace open --web` 子命令,然后从显示的列表中选择要重启的 codespace。
```shell{:copy}
gh codespace open --web
@@ -95,8 +100,8 @@ When you restart a codespace you can choose to open it in {% data variables.prod
{% vscode %}
{% data reusables.vs-code.open-command-palette %}
1. Type `connect` and select **Codespaces: Connect to Codespace** from the list of options.
1. In the list of codespaces, select the codespace you want to restart.
1. 键入 `connect` 并从选项列表中选择“Codespaces: 连接到 Codespace”。
1. 在 codespace 列表中,选择要重启的 codespace。
{% endvscode %}
@@ -106,6 +111,6 @@ When you restart a codespace you can choose to open it in {% data variables.prod
{% endjetbrains %}
## Further reading
## 延伸阅读
- "[The codespace lifecycle](/codespaces/developing-in-codespaces/the-codespace-lifecycle)"
- [codespace 生命周期](/codespaces/developing-in-codespaces/the-codespace-lifecycle)

View File

@@ -0,0 +1,67 @@
---
title: The codespace lifecycle
intro: 'You can develop in a {% data variables.product.prodname_github_codespaces %} environment and maintain your data throughout the entire codespace lifecycle.'
versions:
fpt: '*'
ghec: '*'
type: overview
topics:
- Codespaces
- Developer
redirect_from:
- /codespaces/developing-in-codespaces/codespaces-lifecycle
---
## About the lifecycle of a codespace
The lifecycle of a codespace begins when you create a codespace and ends when you delete it. You can disconnect and reconnect to an active codespace without affecting its running processes. You may stop and restart a codespace without losing changes that you have made to your project.
## Creating a codespace
When you want to work on a project, you can choose to create a new codespace or open an existing codespace. You might want to create a new codespace from a branch of your repository each time you develop in {% data variables.product.prodname_github_codespaces %} or keep a long-running codespace for a feature. {% data reusables.codespaces.starting-new-project-template %} For more information, see "[Creating a codespace for a repository](/codespaces/developing-in-codespaces/creating-a-codespace-for-a-repository)" and "[Creating a codespace from a template](/codespaces/developing-in-codespaces/creating-a-codespace-from-a-template)."
{% data reusables.codespaces.max-number-codespaces %} Similarly, if you reach the maximum number of active codespaces and you try to start another, you are prompted to stop one of your active codespaces.
If you choose to create a new codespace each time you work on a project, you should regularly push your changes so that any new commits are on {% data variables.product.prodname_dotcom %}. If you choose to use a long-running codespace for your project, you should pull from your repository's default branch each time you start working in your codespace so that your environment has the latest commits. This workflow is very similar to if you were working with a project on your local machine.
{% data reusables.codespaces.prebuilds-crossreference %}
## Saving changes in a codespace
When you connect to a codespace through the web, auto-save is enabled automatically for the web editor and configured to save changes after a delay. When you connect to a codespace through {% data variables.product.prodname_vscode %} running on your desktop, you must enable auto-save. For more information, see [Save/Auto Save](https://code.visualstudio.com/docs/editor/codebasics#_save-auto-save) in the {% data variables.product.prodname_vscode %} documentation.
Your work will be saved on a virtual machine in the cloud. You can close and stop a codespace and return to the saved work later. If you have unsaved changes, your editor will prompt you to save them before exiting. However, if your codespace is deleted, then your work will be deleted too. To persist your work, you will need to commit your changes and push them to your remote repository, or publish your work to a new remote repository if you created your codespace from a template. For more information, see "[Using source control in your codespace](/codespaces/developing-in-codespaces/using-source-control-in-your-codespace)."
## Timeouts for {% data variables.product.prodname_github_codespaces %}
If you leave your codespace running without interaction, or if you exit your codespace without explicitly stopping it, the codespace will timeout after a period of inactivity and stop running. By default, a codespace will timeout after 30 minutes of inactivity, but you can customize the duration of the timeout period for new codespaces that you create. For more information about setting the default timeout period for your codespaces, see "[Setting your timeout period for {% data variables.product.prodname_github_codespaces %}](/codespaces/customizing-your-codespace/setting-your-timeout-period-for-github-codespaces)." For more information about stopping a codespace, see "[Stopping a codespace](#stopping-a-codespace)."
When a codespace times out, your data is preserved from the last time your changes were saved. For more information, see "[Saving changes in a codespace](#saving-changes-in-a-codespace)."
## Rebuilding a codespace
You can rebuild your codespace to implement changes to your dev container configuration. For most uses, you can create a new codespace as an alternative to rebuilding a codespace. By default, when you rebuild your codespace, {% data variables.product.prodname_github_codespaces %} will reuse images from your cache to speed up the rebuild process. Alternatively, you can perform a full rebuild, which clears your cache and rebuilds the container with fresh images.
For more information, see "[Introduction to dev containers](/codespaces/setting-up-your-project-for-codespaces/introduction-to-dev-containers#applying-configuration-changes-to-a-codespace)" and "[Performing a full rebuild of a container](/codespaces/codespaces-reference/performing-a-full-rebuild-of-a-container)."
## Stopping a codespace
{% data reusables.codespaces.stopping-a-codespace %} For more information, see "[Stopping and starting a codespace](/codespaces/developing-in-codespaces/stopping-and-starting-a-codespace)."
## Deleting a codespace
You can create a codespace for a particular task and then safely delete the codespace after you push your changes to a remote branch.
If you try to delete a codespace with unpushed git commits, your editor will notify you that you have changes that have not been pushed to a remote branch. You can push any desired changes and then delete your codespace, or continue to delete your codespace and any uncommitted changes. You can also export your code to a new branch without creating a new codespace. For more information, see "[Exporting changes to a branch](/codespaces/troubleshooting/exporting-changes-to-a-branch)."
Codespaces that have been stopped and remain inactive for a specified period of time will be deleted automatically. By default, inactive codespaces are deleted after 30 days, but you can customize your codespace retention period. For more information, see "[Configuring automatic deletion of your codespaces](/codespaces/customizing-your-codespace/configuring-automatic-deletion-of-your-codespaces)."
If you create a codespace, it will continue to accrue storage charges until it is deleted, irrespective of whether it is active or stopped. For more information, see "[About billing for {% data variables.product.prodname_github_codespaces %}](/billing/managing-billing-for-github-codespaces/about-billing-for-github-codespaces#billing-for-storage-usage)." Deleting a codespace does not reduce the current billable amount for {% data variables.product.prodname_github_codespaces %}, which accumulates during each monthly billing cycle. For more information, see "[Viewing your {% data variables.product.prodname_github_codespaces %} usage](/billing/managing-billing-for-github-codespaces/viewing-your-github-codespaces-usage)."
For more information on deleting a codespace, see "[Deleting a codespace](/codespaces/developing-in-codespaces/deleting-a-codespace)."
## Losing the connection while using {% data variables.product.prodname_github_codespaces %}
{% data variables.product.prodname_github_codespaces %} is a cloud-based development environment and requires an internet connection. If you lose connection to the internet while working in a codespace, you will not be able to access your codespace. However, any uncommitted changes will be saved. When you have access to an internet connection again, you can connect to your codespace in the exact same state that it was left in. If you have an unstable internet connection, you should commit and push your changes often.
If you know that you will often be working offline, you can use your `devcontainer.json` file with the ["Dev Containers" extension](https://marketplace.visualstudio.com/items?itemName=ms-vscode-remote.remote-containers) for {% data variables.product.prodname_vscode_shortname %} to build and attach to a local development container for your repository. For more information, see [Developing inside a container](https://code.visualstudio.com/docs/remote/containers) in the {% data variables.product.prodname_vscode %} documentation.

View File

@@ -1,7 +1,7 @@
---
title: Using GitHub Codespaces for pull requests
title: GitHub Codespaces 用于拉取请求
shortTitle: Pull requests
intro: 'You can use {% data variables.product.prodname_github_codespaces %} in your web browser, or in {% data variables.product.prodname_vscode %} to create pull requests, review pull requests, and address review comments.'
intro: '你可以在 Web 浏览器中或 {% data variables.product.prodname_vscode %} 中使用 {% data variables.product.prodname_github_codespaces %} 来创建拉取请求、审阅拉取请求和处理审阅注释。'
versions:
fpt: '*'
ghec: '*'
@@ -12,47 +12,52 @@ topics:
- Developer
redirect_from:
- /codespaces/developing-in-codespaces/using-codespaces-for-pull-requests
ms.openlocfilehash: 6932f8eb9095987bfe808080983970c8807b6d93
ms.sourcegitcommit: e8c012864f13f9146e53fcb0699e2928c949ffa8
ms.translationtype: HT
ms.contentlocale: zh-CN
ms.lasthandoff: 11/09/2022
ms.locfileid: '148159462'
---
## 关于 {% data variables.product.prodname_github_codespaces %} 中的拉取请求
## About pull requests in {% data variables.product.prodname_github_codespaces %}
{% data variables.product.prodname_github_codespaces %} 为你提供了处理拉取请求可能需要的许多功能:
{% data variables.product.prodname_github_codespaces %} provides you with many of the capabilities you might need to work with pull requests:
- [创建拉取请求](/codespaces/developing-in-codespaces/using-source-control-in-your-codespace#raising-a-pull-request) - 使用终端和 Git 命令或源代码管理视图,可以像在 {% data variables.product.prodname_dotcom_the_website %} 上一样创建拉取请求。 如果存储库使用拉取请求模板,则可以在源代码管理视图中使用它。
- [打开拉取请求](#opening-a-pull-request-in-codespaces) - 可以在代码空间中打开现有拉取请求,前提是你对要合并的分支具有代码空间访问权限。
- [审查拉取请求](#reviewing-a-pull-request-in-codespaces) - 在代码空间中打开拉取请求后可以使用“GitHub 拉取请求”视图添加审查评论和批准拉取请求。 还可以使用 {% data variables.product.prodname_github_codespaces %} 来[查看审阅注释](#view-comments-from-a-review-in-codespaces)。
- [Create a pull request](/codespaces/developing-in-codespaces/using-source-control-in-your-codespace#raising-a-pull-request) - Using either the Terminal and Git commands or the Source Control view, you can create pull requests just as you would on {% data variables.product.prodname_dotcom_the_website %}. If the repository uses a pull request template, you'll be able to use this within the Source Control view.
- [Open a pull request](#opening-a-pull-request-in-codespaces) You can open an existing pull request in a codespace, provided you have codespace access to the branch that is being merged in.
- [Review a pull request](#reviewing-a-pull-request-in-codespaces) - Once you have opened a pull request in a codespace, you can use the "GitHub Pull Request" view to add review comments and approve pull requests. You can also use {% data variables.product.prodname_github_codespaces %} to [view review comments](#view-comments-from-a-review-in-codespaces).
## Opening a pull request in {% data variables.product.prodname_codespaces %}
## 在 {% data variables.product.prodname_codespaces %} 中打开拉取请求
{% data reusables.repositories.sidebar-pr %}
1. In the list of pull requests, click the pull request you'd like to open in {% data variables.product.prodname_codespaces %}.
1. On the right-hand side of your screen, click **{% octicon "code" aria-label="The code icon" %} Code**.
1. In the {% data variables.product.prodname_codespaces %} tab, click the plus sign ({% octicon "plus" aria-label="The plus icon" %})
1. 在拉取请求列表中,单击要在 {% data variables.product.prodname_codespaces %} 中打开的拉取请求。
1. 在屏幕右侧,单击“{% octicon "code" aria-label="The code icon" %} 代码”。
1. {% data variables.product.prodname_codespaces %} 选项卡中,单击加号 ({% octicon "plus" aria-label="The plus icon" %})
![Option to open PR in a codespace](/assets/images/help/codespaces/open-with-codespaces-pr.png)
![用于在代码空间中打开 PR 的选项](/assets/images/help/codespaces/open-with-codespaces-pr.png)
A codespace is created for the pull request branch and is opened in your default editor for {% data variables.product.prodname_github_codespaces %}.
为拉取请求分支创建 codespace,并在 {% data variables.product.prodname_github_codespaces %} 的默认编辑器中打开。
## Reviewing a pull request in {% data variables.product.prodname_codespaces %}
## {% data variables.product.prodname_codespaces %} 中审阅拉取请求
1. With your default editor set to either {% data variables.product.prodname_vscode %} or {% data variables.product.prodname_vscode %} for Web, open the pull request in a codespace, as described in "[Opening a pull request](/codespaces/developing-in-codespaces/using-codespaces-for-pull-requests#opening-a-pull-request-in-codespaces)" above.
2. In the Activity Bar, click the **GitHub Pull Request** view. This view only appears when you open a pull request in a codespace.
![Option to open PR in a codespace](/assets/images/help/codespaces/github-pr-view.png)
3. To review a specific file, click the **Open File** icon in the sidebar.
![Option to open PR in a codespace](/assets/images/help/codespaces/changes-in-files.png)
4. To add review comments, click the **+** icon next to the line number. Type your review comment and then click **Start Review**.
![Option to open PR in a codespace](/assets/images/help/codespaces/start-review.png)
5. When you are finished adding review comments, from the sidebar you can choose to either submit the comments, approve the changes, or request changes.
![Option to open PR in a codespace](/assets/images/help/codespaces/submit-review.png)
1. 将默认编辑器设置为 {% data variables.product.prodname_vscode %} {% data variables.product.prodname_vscode %} for Web,在 codespace 中打开拉取请求,如上面的“[打开拉取请求](/codespaces/developing-in-codespaces/using-codespaces-for-pull-requests#opening-a-pull-request-in-codespaces)”中所述。
2. 在活动栏中单击“GitHub 拉取请求”视图。 仅当在代码空间中打开拉取请求时,才会显示此视图。
![用于在代码空间中打开 PR 的选项](/assets/images/help/codespaces/github-pr-view.png)
3. 若要查看特定文件,请单击边栏中的“打开文件”图标。
![用于在代码空间中打开 PR 的选项](/assets/images/help/codespaces/changes-in-files.png)
4. 若要添审阅注释,请单击行号旁边的 + 图标。 键入审阅注释,然后单击“开始审阅”。
![用于在代码空间中打开 PR 的选项](/assets/images/help/codespaces/start-review.png)
5. 添加完审阅注释后,可以从边栏中选择提交评论、批准更改或请求更改。
![用于在代码空间中打开 PR 的选项](/assets/images/help/codespaces/submit-review.png)
For more information on reviewing a pull request, see "[Reviewing proposed changes in a pull request](/github/collaborating-with-pull-requests/reviewing-changes-in-pull-requests/reviewing-proposed-changes-in-a-pull-request)."
有关查看拉取请求的详细信息,请参阅“[查看拉取请求中的建议更改](/github/collaborating-with-pull-requests/reviewing-changes-in-pull-requests/reviewing-proposed-changes-in-a-pull-request)”。
## View comments from a review in {% data variables.product.prodname_codespaces %}
## 查看 {% data variables.product.prodname_codespaces %} 中审阅的评论
Once you have received feedback on a pull request, you can [open it in a codespace](#opening-a-pull-request-in-codespaces) in your web browser, or in {% data variables.product.prodname_vscode_shortname %}, to see the [review comments](#reviewing-a-pull-request-in-codespaces). From there you can respond to comments, add reactions, or dismiss the review.
收到有关拉取请求的反馈后,可以在 Web 浏览器的 [codespace](#opening-a-pull-request-in-codespaces) {% data variables.product.prodname_vscode_shortname %} 中打开它,以查看[审阅注释](#reviewing-a-pull-request-in-codespaces)。 从那里,您可以回复评论、添加回复或关闭评论。
![Option to open PR in a codespace](/assets/images/help/codespaces/incorporating-codespaces.png)
![用于在代码空间中打开 PR 的选项](/assets/images/help/codespaces/incorporating-codespaces.png)

View File

@@ -1,7 +1,7 @@
---
title: Using GitHub Codespaces in Visual Studio Code
title: 在 Visual Studio Code 中使用 GitHub Codespaces
shortTitle: Visual Studio Code
intro: 'You can develop in your codespace directly in {% data variables.product.prodname_vscode %} by connecting the {% data variables.product.prodname_github_codespaces %} extension with your account on {% data variables.product.product_name %}.'
intro: '可以将 {% data variables.product.prodname_github_codespaces %} 扩展连接到 {% data variables.product.product_name %} 上的帐户,直接在 {% data variables.product.prodname_vscode %} 中开发 codespace。'
redirect_from:
- /github/developing-online-with-codespaces/using-codespaces-in-visual-studio-code
- /github/developing-online-with-codespaces/connecting-to-your-codespace-from-visual-studio-code
@@ -15,70 +15,75 @@ topics:
- Codespaces
- Visual Studio Code
- Developer
ms.openlocfilehash: c651620e2795fb29f2b995f745ad3880e99c0f4e
ms.sourcegitcommit: e8c012864f13f9146e53fcb0699e2928c949ffa8
ms.translationtype: HT
ms.contentlocale: zh-CN
ms.lasthandoff: 11/09/2022
ms.locfileid: '148159440'
---
## About {% data variables.product.prodname_github_codespaces %} in {% data variables.product.prodname_vscode %}
## 关于 {% data variables.product.prodname_vscode %} 中的 {% data variables.product.prodname_github_codespaces %}
You can use your local install of {% data variables.product.prodname_vscode %} to create, manage, work in, and delete codespaces. {% data reusables.codespaces.using-codespaces-in-vscode %} For more information on setting up {% data variables.product.prodname_github_codespaces %} in {% data variables.product.prodname_vscode_shortname %}, see "[Prerequisites](#prerequisites)."
您可以使用本地安装的 {% data variables.product.prodname_vscode %} 来创建、管理、处理和删除代码空间。 {% data reusables.codespaces.using-codespaces-in-vscode %} 有关在 {% data variables.product.prodname_vscode_shortname %} 中设置 {% data variables.product.prodname_github_codespaces %} 的详细信息,请参见“[先决条件](#prerequisites)”。
By default, if you create a new codespace on {% data variables.product.prodname_dotcom_the_website %}, it will open in the browser. If you would prefer to open any new codespaces in {% data variables.product.prodname_vscode_shortname %} automatically, you can set your default editor to be {% data variables.product.prodname_vscode_shortname %}. For more information, see "[Setting your default editor for {% data variables.product.prodname_github_codespaces %}](/codespaces/customizing-your-codespace/setting-your-default-editor-for-github-codespaces)."
默认情况下,如果在 {% data variables.product.prodname_dotcom_the_website %} 上创建新的代码空间,它将在浏览器中打开。 如果希望自动打开 {% data variables.product.prodname_vscode_shortname %} 中的任何新 codespace则可以将默认编辑器设置为 {% data variables.product.prodname_vscode_shortname %}。 有关详细信息,请参阅“[设置 {% data variables.product.prodname_github_codespaces %} 的默认编辑器](/codespaces/customizing-your-codespace/setting-your-default-editor-for-github-codespaces)”。
If you prefer to work in the browser, but want to continue using your existing {% data variables.product.prodname_vscode_shortname %} extensions, themes, and shortcuts, you can turn on Settings Sync. For more information, see "[Personalizing {% data variables.product.prodname_github_codespaces %} for your account](/codespaces/customizing-your-codespace/personalizing-github-codespaces-for-your-account#settings-sync)."
如果你更喜欢在浏览器中工作,但想要继续使用现有 {% data variables.product.prodname_vscode_shortname %} 扩展、主题和快捷方式,可打开“设置同步”。有关详细信息,请参阅“[个性化帐户的 {% data variables.product.prodname_github_codespaces %}](/codespaces/customizing-your-codespace/personalizing-github-codespaces-for-your-account#settings-sync)”。
## Prerequisites
## 先决条件
To develop in a codespace directly in {% data variables.product.prodname_vscode_shortname %}, you must install and sign into the {% data variables.product.prodname_github_codespaces %} extension with your {% data variables.product.product_name %} credentials. The {% data variables.product.prodname_github_codespaces %} extension requires {% data variables.product.prodname_vscode_shortname %} October 2020 Release 1.51 or later.
若要直接在 {% data variables.product.prodname_vscode_shortname %} 的 codespace 中进行开发,必须使用 {% data variables.product.product_name %} 凭据安装并登录到 {% data variables.product.prodname_github_codespaces %} 扩展。 {% data variables.product.prodname_github_codespaces %} 扩展需要 {% data variables.product.prodname_vscode_shortname %} 2020 年 10 月 版本 1.51 或更高版本。
Use the {% data variables.product.prodname_vscode_marketplace %} to install the [{% data variables.product.prodname_github_codespaces %}](https://marketplace.visualstudio.com/items?itemName=GitHub.codespaces) extension. For more information, see [Extension Marketplace](https://code.visualstudio.com/docs/editor/extension-gallery) in the {% data variables.product.prodname_vscode_shortname %} documentation.
使用 {% data variables.product.prodname_vscode_marketplace %} 安装 [{% data variables.product.prodname_github_codespaces %}](https://marketplace.visualstudio.com/items?itemName=GitHub.codespaces) 扩展。 有关详细信息,请参阅 {% data variables.product.prodname_vscode_shortname %} 文档中的[扩展市场](https://code.visualstudio.com/docs/editor/extension-gallery)。
{% mac %}
{% data reusables.codespaces.click-remote-explorer-icon-vscode %}
1. Click **Sign in to {% data variables.product.prodname_dotcom %}...**.
1. 单击“登录到 {% data variables.product.prodname_dotcom %}…”。
![Signing in to {% data variables.product.prodname_github_codespaces %}](/assets/images/help/codespaces/sign-in-to-view-codespaces-vscode-mac.png)
![登录到 {% data variables.product.prodname_github_codespaces %}](/assets/images/help/codespaces/sign-in-to-view-codespaces-vscode-mac.png)
2. To authorize {% data variables.product.prodname_vscode_shortname %} to access your account on {% data variables.product.product_name %}, click **Allow**.
3. Sign in to {% data variables.product.product_name %} to approve the extension.
2. 要授权 {% data variables.product.prodname_vscode_shortname %} 访问你在 {% data variables.product.product_name %} 上的帐户,请单击“允许”。
3. 登录 {% data variables.product.product_name %} 以审批扩展。
{% endmac %}
{% windows %}
{% data reusables.codespaces.click-remote-explorer-icon-vscode %}
1. Use the "REMOTE EXPLORER" drop-down, then click **{% data variables.product.prodname_github_codespaces %}**.
1. 使用“远程资源管理器”下拉列表,然后单击“{% data variables.product.prodname_github_codespaces %}”。
![The {% data variables.product.prodname_github_codespaces %} header](/assets/images/help/codespaces/codespaces-header-vscode.png)
![{% data variables.product.prodname_github_codespaces %} 标头](/assets/images/help/codespaces/codespaces-header-vscode.png)
1. Click **Sign in to view {% data variables.product.prodname_codespaces %}**.
1. 单击“登录以查看 {% data variables.product.prodname_codespaces %}”。
![Signing in to view {% data variables.product.prodname_github_codespaces %}](/assets/images/help/codespaces/sign-in-to-view-codespaces-vscode.png)
![登录以查看 {% data variables.product.prodname_github_codespaces %}](/assets/images/help/codespaces/sign-in-to-view-codespaces-vscode.png)
1. To authorize {% data variables.product.prodname_vscode_shortname %} to access your account on {% data variables.product.product_name %}, click **Allow**.
1. Sign in to {% data variables.product.product_name %} to approve the extension.
1. 要授权 {% data variables.product.prodname_vscode_shortname %} 访问你在 {% data variables.product.product_name %} 上的帐户,请单击“允许”。
1. 登录 {% data variables.product.product_name %} 以审批扩展。
{% endwindows %}
## Creating a codespace in {% data variables.product.prodname_vscode_shortname %}
## {% data variables.product.prodname_vscode_shortname %} 中创建 codespace
{% data reusables.codespaces.creating-a-codespace-in-vscode %}
## Opening a codespace in {% data variables.product.prodname_vscode_shortname %}
## {% data variables.product.prodname_vscode_shortname %} 中打开 codespace
{% data reusables.codespaces.click-remote-explorer-icon-vscode %}
1. Under "Codespaces", click the codespace you want to develop in.
1. Click the Connect to Codespace icon.
1. 在“Codespaces(代码空间)”下,单击您要在其中开发的代码空间。
1. 单击 Connect to Codespace(连接到代码空间)图标。
![The Connect to Codespace icon in {% data variables.product.prodname_vscode_shortname %}](/assets/images/help/codespaces/click-connect-to-codespace-icon-vscode.png)
![{% data variables.product.prodname_vscode_shortname %} 中的“连接到 codespace”图标](/assets/images/help/codespaces/click-connect-to-codespace-icon-vscode.png)
## Changing the machine type in {% data variables.product.prodname_vscode_shortname %}
## {% data variables.product.prodname_vscode_shortname %} 中更改计算机类型
{% data reusables.codespaces.codespaces-machine-types %} You can change the machine type of your codespace at any time.
{% data reusables.codespaces.codespaces-machine-types %} 可以随时更改 codespace 的计算机类型。
{% note %}
**Note**: {% data reusables.codespaces.codespaces-machine-type-availability %}
注意:{% data reusables.codespaces.codespaces-machine-type-availability %}
{% endnote %}
@@ -86,22 +91,22 @@ Use the {% data variables.product.prodname_vscode_marketplace %} to install the
{% data reusables.codespaces.about-changing-storage-size %}
## Deleting a codespace in {% data variables.product.prodname_vscode_shortname %}
## {% data variables.product.prodname_vscode_shortname %} 中删除 codespace
{% data reusables.codespaces.deleting-a-codespace-in-vscode %}
## Switching to the Insiders build of {% data variables.product.prodname_vscode_shortname %}
## 切换到 {% data variables.product.prodname_vscode_shortname %} 的预览体验版本
You can use the [Insiders Build of {% data variables.product.prodname_vscode_shortname %}](https://code.visualstudio.com/docs/setup/setup-overview#_insiders-nightly-build) within {% data variables.product.prodname_github_codespaces %}.
可以在 {% data variables.product.prodname_github_codespaces %} 中使用 [{% data variables.product.prodname_vscode_shortname %} 的预览体验版本](https://code.visualstudio.com/docs/setup/setup-overview#_insiders-nightly-build)
1. In bottom left of your {% data variables.product.prodname_github_codespaces %} window, select **{% octicon "gear" aria-label="The settings icon" %} Settings**.
2. From the list, select "Switch to Insiders Version".
1. {% data variables.product.prodname_github_codespaces %} 窗口的左下角,选择“{% octicon "gear" aria-label="The settings icon" %} 设置”。
2. 从列表中,选择“Switch to Insiders Version(切换到内部版本)”。
![Clicking on "Insiders Build" in {% data variables.product.prodname_github_codespaces %}](/assets/images/help/codespaces/codespaces-insiders-vscode.png)
![单击 {% data variables.product.prodname_github_codespaces %} 中的“预览体验版本”](/assets/images/help/codespaces/codespaces-insiders-vscode.png)
3. Once selected, {% data variables.product.prodname_github_codespaces %} will continue to open in Insiders Version.
3. 选择后,{% data variables.product.prodname_github_codespaces %} 将继续以内部版本打开。
## Further reading
## 延伸阅读
- "[Using the {% data variables.product.prodname_vscode_command_palette %} in {% data variables.product.prodname_github_codespaces %}](/codespaces/codespaces-reference/using-the-vs-code-command-palette-in-codespaces)"
- "[Using {% data variables.product.prodname_copilot %} in {% data variables.product.prodname_github_codespaces %}](/codespaces/codespaces-reference/using-github-copilot-in-github-codespaces)"
- [ {% data variables.product.prodname_github_codespaces %} 中使用 {% data variables.product.prodname_vscode_command_palette %}](/codespaces/codespaces-reference/using-the-vs-code-command-palette-in-codespaces)
- “在[{% data variables.product.prodname_github_codespaces %} 中使用 {% data variables.product.prodname_copilot %}](/codespaces/codespaces-reference/using-github-copilot-in-github-codespaces)

View File

@@ -0,0 +1,138 @@
---
title: 在 JetBrains IDE 中使用 GitHub Codespaces
shortTitle: JetBrains IDEs
intro: 可以使用 JetBrains 网关连接到 codespace并在你喜欢的 JetBrains IDE 中工作。
miniTocMaxHeadingLevel: 3
versions:
fpt: '*'
ghec: '*'
type: how_to
topics:
- Codespaces
- Developer
ms.openlocfilehash: f522bf481e932f9735560ee4a1fec21944ced2e7
ms.sourcegitcommit: e8c012864f13f9146e53fcb0699e2928c949ffa8
ms.translationtype: HT
ms.contentlocale: zh-CN
ms.lasthandoff: 11/09/2022
ms.locfileid: '148159504'
---
{% data reusables.codespaces.codespaces-jetbrains-beta-note %}
## 关于 JetBrains IDE 中的 {% data variables.product.prodname_codespaces %}
如果使用 JetBrains IDE 来处理代码,则可以利用在 codespace 中工作的优势。 可以使用 JetBrains 网关应用程序执行此操作。
安装 JetBrains 网关后,可以将 JetBrains 设置为默认编辑器,然后每当从 {% data variables.product.prodname_dotcom_the_website %} 打开 codespace 时JetBrains 网关将启动,以允许你选择 JetBrains IDE 并连接到 codespace。
{% note %}
**注意**JetBrains 网关中只有现有的 codespace 可用。 可以在 {% data variables.product.prodname_dotcom_the_website %} 中或使用 {% data variables.product.prodname_cli %} 创建 codespace。 有关详细信息,请参阅“[为存储库创建 codespace](/codespaces/developing-in-codespaces/creating-a-codespace-for-a-repository)”。
{% endnote %}
### JetBrains 远程开发连接过程
在 JetBrains IDE 中使用 codespace 的基本过程如下所示。
* 在 JetBrains 网关应用程序中,选择一个活动或已停止的 codespace。
* 然后选择要使用的 JetBrains IDE。
* 然后将所选 JetBrains IDE 下载到托管 codespace 和源代码的远程虚拟机。
* 然后将 JetBrains 瘦客户端应用程序下载到本地计算机并启动。
* 客户端应用程序连接到完整的后端 IDE。
* 可以在客户端应用程序中以与在本地环境中相同的方式处理代码。
## 先决条件
若要在 JetBrains IDE 中的 codespace 中工作,需要:
* 有效的 JetBrains 许可证
* JetBrains 网关应用程序
* {% data variables.product.prodname_cli %} 版本 2.18.0 或更高版本
* 运行 SSH 服务器的现有 codespace
### JetBrains 许可证
必须拥有至少一个受支持的 JetBrains IDE 的许可证,才能从 JetBrains 网关连接到 codespace。
### JetBrains 网关
可以从 JetBrains 工具箱应用程序安装和更新 JetBrains 网关。
1. 下载并安装 [JetBrains 工具箱](https://www.jetbrains.com/toolbox-app)。
1. 打开 JetBrains 工具箱。
1. 在可用工具列表中找到“网关”,然后单击“安装” 。
![JetBrains 工具箱的屏幕截图](/assets/images/help/codespaces/jetbrains-toolbox.png)
### {% data variables.product.prodname_cli %}
JetBrains 网关的 {% data variables.product.prodname_github_codespaces %} 插件要求先安装并配置 {% data variables.product.prodname_cli %} 版本 2.18.0 或更高版本,然后才能从 JetBrains 网关打开 codespace。
使用此命令检查 {% data variables.product.prodname_cli %} 的版本:
```shell{:copy}
gh --version
```
有关详细信息,请参阅“[关于 GitHub CLI](/github-cli/github-cli/about-github-cli)”。
### 运行 SSH 服务器的 codespace
必须具有要连接到的现有 codespace。 {% data reusables.codespaces.ways-to-create-a-codespace %} 有关详细信息,请参阅“[为存储库创建 codespace](/codespaces/developing-in-codespaces/creating-a-codespace-for-a-repository)”。
{% data reusables.codespaces.ssh-server-installed %}
有关 `devcontainer.json` 文件和默认容器映像的详细信息,请参阅“[开发容器简介](/codespaces/setting-up-your-project-for-codespaces/introduction-to-dev-containers)”。
{% note %}
**注意**:有关通过 SSH 连接到 codespace 的帮助,请参阅“[{% data variables.product.prodname_github_codespaces %} 客户端故障排除](/codespaces/troubleshooting/troubleshooting-github-codespaces-clients?tool=jetbrains#ssh-connection-issues)”。
{% endnote %}
## 设置 JetBrains 网关
首次对 {% data variables.product.prodname_github_codespaces %} 使用 JetBrains 网关时,必须安装 {% data variables.product.prodname_codespaces %} 插件。 还必须允许 JetBrains 网关使用 {% data variables.product.prodname_dotcom %} 帐户访问 {% data variables.product.prodname_dotcom_the_website %}。
1. 打开 JetBrains 网关应用程序。
1. 在“安装更多提供程序”下,单击 {% data variables.product.prodname_github_codespaces %} 的“安装”链接 。
![JetBrains 网关初始视图的屏幕截图](/assets/images/help/codespaces/jetbrains-gateway-initial-view.png)
1. 单击“连接到 Codespace”。
![带有“连接到 Codespace”按钮的网关屏幕截图](/assets/images/help/codespaces/jetbrains-gateway-connect.png)
1. 在“欢迎使用 JetBrains 网关”对话框中,单击“使用 {% data variables.product.prodname_dotcom %} 登录”。
![“登录”按钮的屏幕截图](/assets/images/help/codespaces/jetbrains-gateway-sign-in.png)
1. 单击一次性代码旁边的图标进行复制,然后单击登录链接。
![一次性登录代码的屏幕截图](/assets/images/help/codespaces/jetbrains-gateway-login-code.png)
1. 如果当前未登录到 {% data variables.product.prodname_dotcom %},则会显示登录页面。
* 输入详细信息,然后单击“登录”。
* 进行身份验证,例如输入双因素身份验证代码。
1. 在“设备激活”页上,粘贴复制的代码,然后单击“继续”。
1. 如果你属于组织,则会显示“单一登录到组织”页。 单击要授权 JetBrains 网关访问的组织旁边的“授权”,然后单击“继续” 。
1. 在“为 JetBrains 授权 {% data variables.product.prodname_github_codespaces %}”页上,单击“授权 {% data variables.product.prodname_dotcom %}”。
1. 返回到 JetBrains 网关应用程序,并从当前活动或已停止的 codespace 列表中打开一个 codespace请参阅以下过程的步骤 3。
## 在 JetBrains IDE 中打开一个 codespace
{% data reusables.codespaces.opening-codespace-in-jetbrains %}
首次连接到 codespace 时,后端 IDE 将下载到远程计算机。 这可能需要几分钟的时间。 下次连接到同一 codespace 时不需要执行此步骤,从而加快连接过程。
然后启动后端 IDE。 同样,如果将来要重新连接到保持运行的后端 IDE则不需要执行此步骤。
然后启动客户端应用程序。
## 延伸阅读
- “[在 codespace 中开发](/codespaces/developing-in-codespaces/developing-in-a-codespace)”
- “[将 {% data variables.product.prodname_github_codespaces %} 插件用于 JetBrains](/codespaces/codespaces-reference/using-the-github-codespaces-plugin-for-jetbrains)”
- “[在 {% data variables.product.prodname_github_codespaces %} 中使用 {% data variables.product.prodname_copilot %}](/codespaces/codespaces-reference/using-github-copilot-in-github-codespaces)”
- “[{% data variables.product.prodname_github_codespaces %} 客户端故障排除](/codespaces/troubleshooting/troubleshooting-github-codespaces-clients?tool=jetbrains)”

View File

@@ -1,6 +1,6 @@
---
title: Using source control in your codespace
intro: After making changes to a file in your codespace you can quickly commit the changes and push your update to the remote repository.
title: 在代码空间中使用源控制
intro: 在对代码空间中的文件进行更改后,您可以快速提交更改并将更新推送到远程仓库。
versions:
fpt: '*'
ghec: '*'
@@ -10,37 +10,42 @@ topics:
- Fundamentals
- Developer
shortTitle: Source control
ms.openlocfilehash: 513bf0729e1f04bf93f45999b2fa9e45231add5c
ms.sourcegitcommit: e8c012864f13f9146e53fcb0699e2928c949ffa8
ms.translationtype: HT
ms.contentlocale: zh-CN
ms.lasthandoff: 11/09/2022
ms.locfileid: '148159460'
---
{% jetbrains %}
{% data reusables.codespaces.codespaces-jetbrains-beta-note %}
{% endjetbrains %}
## About source control in {% data variables.product.prodname_github_codespaces %}
## 关于 {% data variables.product.prodname_github_codespaces %} 中的源代码管理
You can perform all the Git actions you need directly within your codespace. For example, you can fetch changes from a remote repository, switch branches, create a new branch, commit and push changes, and create a pull request. You can use the integrated terminal within your codespace to enter Git commands, or you can click icons and menu options to complete all the most common Git tasks. This guide explains how to use the graphical user interface for source control.
您可以直接在代码空间内执行所需的所有 Git 操作。 例如,可以从远程存储库获取更改、切换分支、创建新分支、提交和推送更改以及创建拉取请求。 您可以使用代码空间内的集成终端输入 Git 命令,也可以单击图标和菜单选项以完成所有最常见的 Git 任务。 本指南解释如何使用图形用户界面来控制源代码。
{% vscode %}
For more information about Git support in {% data variables.product.prodname_vscode %}, see "[Using Version Control in VS Code](https://code.visualstudio.com/docs/editor/versioncontrol#_git-support)" in the {% data variables.product.prodname_vscode %} documentation.
有关 {% data variables.product.prodname_vscode %} 中的 Git 支持的详细信息,请参阅 {% data variables.product.prodname_vscode %} 文档中的“[在 VS Code 中使用版本控制](https://code.visualstudio.com/docs/editor/versioncontrol#_git-support)”。
{% endvscode %}
{% webui %}
Source control in the {% data variables.product.prodname_vscode %} web client uses the same workflow as the {% data variables.product.prodname_vscode %} desktop application. For more information, see "[Using Version Control in VS Code](https://code.visualstudio.com/docs/editor/versioncontrol#_git-support)" in the {% data variables.product.prodname_vscode %} documentation.
{% data variables.product.prodname_vscode %} Web 客户端中的源代码管理使用与 {% data variables.product.prodname_vscode %} 桌面应用程序相同的工作流。 有关详细信息,请参阅 {% data variables.product.prodname_vscode %} 文档中的“[在 VS Code 中使用版本控制](https://code.visualstudio.com/docs/editor/versioncontrol#_git-support)”。
{% endwebui %}
A typical workflow for updating a file using {% data variables.product.prodname_github_codespaces %} would be:
使用 {% data variables.product.prodname_github_codespaces %} 更新文件的典型工作流程将是:
* From the default branch of your repository on {% data variables.product.prodname_dotcom %}, create a codespace. See "[Creating a codespace for a repository](/codespaces/developing-in-codespaces/creating-a-codespace-for-a-repository)."
* In your codespace, create a new branch to work on.
* Make your changes and save them.
* Commit the change.
* Raise a pull request.
* 从 {% data variables.product.prodname_dotcom %} 上仓库的默认分支,创建代码空间。 请参阅“[为存储库创建 codespace](/codespaces/developing-in-codespaces/creating-a-codespace-for-a-repository)”。
* 在代码空间中,创建一个新的分支来操作。
* 进行更改并保存。
* 提交更改。
* 提出拉取请求。
{% webui %}
@@ -56,67 +61,67 @@ A typical workflow for updating a file using {% data variables.product.prodname_
{% jetbrains %}
## Creating or switching branches
## 创建或切换分支
1. Click the branch name at the right side of the status bar.
1. 单击状态栏右侧的分支名称。
![Screenshot of the branch name in the status bar](/assets/images/help/codespaces/jetbrains-branch-button.png)
![状态栏中的分支名称的屏幕截图](/assets/images/help/codespaces/jetbrains-branch-button.png)
1. In the pop-up menu, do one of the following:
* To create a new branch based on the current branch, click the name of the current branch, then choose **New Branch**.
1. 在弹出菜单中,执行以下操作之一:
* 要基于当前分支创建新分支,请单击当前分支的名称,然后选择“新建分支”。
![Screenshot of the new branch option](/assets/images/help/codespaces/jetbrains-new-branch-option.png)
![“新建分支”选项的屏幕截图](/assets/images/help/codespaces/jetbrains-new-branch-option.png)
Enter a name for the new branch and click **Create**.
输入新建分支的名称并单击“创建”。
![Screenshot of the create branch dialog box](/assets/images/help/codespaces/jetbrains-create-branch-dialog.png)
![“创建分支”对话框的屏幕截图](/assets/images/help/codespaces/jetbrains-create-branch-dialog.png)
* To check out an existing branch, start typing the name of the branch you want to check out. Click the branch from the list, then click **Checkout**.
* 要签出现有分支,请开始键入要签出的分支的名称。单击列表中的分支,然后单击“签出”。
![Screenshot of the checkout option](/assets/images/help/codespaces/jetbrains-checkout-submenu.png)
![签出页面的屏幕截图](/assets/images/help/codespaces/jetbrains-checkout-submenu.png)
{% tip %}
**Tip**: If someone has recently changed a file on the remote repository, in the branch you switched to, you may not see those changes until you pull the changes into your codespace.
提示:如果有人最近在远程存储库上更改了文件,则在你切换到的分支中,只有将更改拉取到 codespace 中之后,你才能看到这些更改。
{% endtip %}
## Committing your changes
## 提交更改
1. At the right side of the navigation bar, click the check mark.
1. 在导航栏的右侧,单击复选标记。
![Screenshot of the commit check mark](/assets/images/help/codespaces/jetbrains-commit-button.png)
![“提交”复选标记的屏幕截图](/assets/images/help/codespaces/jetbrains-commit-button.png)
1. In the Commit Changes dialog box, enter a commit message.
1. Click **Commit**.
1. 在“提交更改”对话框中,输入提交消息。
1. 单击“提交”。
Alternatively, click the down arrow beside **Commit** and click **Commit and Push**.
此外,也可以单击“提交”旁边的向下箭头,然后单击“提交并推送” 。
![Screenshot of the commit and push button](/assets/images/help/codespaces/jetbrains-commit-and-push.png)
![“提交并推送”按钮的屏幕截图](/assets/images/help/codespaces/jetbrains-commit-and-push.png)
## Pulling changes from the remote repository
## 从远程仓库拉取更改
You can pull changes from the same branch on the remote repository and apply those changes to the copy of the repository you are working on in your codespace.
可以从远程存储库的同一分支中拉取更改,并将这些更改应用到你在 codespace 中处理的存储库副本。
1. At the right side of the navigation bar, click the downward pointing arrow.
1. 在导航栏的右侧,单击向下箭头。
![Screenshot of the update project downward arrow button](/assets/images/help/codespaces/jetbrains-update-project-button.png)
![更新项目向下箭头按钮的屏幕截图](/assets/images/help/codespaces/jetbrains-update-project-button.png)
1. In the Update Project dialog box, choose whether you want to merge or rebase the incoming changes.
1. 在“更新项目”对话框中,选择是要合并还是变基传入的更改。
![Screenshot of the Update Project dialog box](/assets/images/help/codespaces/jetbrains-update-options.png)
![“更新项目”对话框的屏幕截图](/assets/images/help/codespaces/jetbrains-update-options.png)
1. Click **OK**.
1. 单击 **“确定”** 。
## Pushing changes to your remote repository
## 将更改推送到远程仓库
You can push changes you've saved and committed. This applies those changes to the upstream branch on the remote repository. You might want to do this if you're not yet ready to create a pull request, or if you prefer to create a pull request on {% data variables.product.prodname_dotcom %}.
可以推送保存并提交的更改。 这将应用这些更改到远程仓库上的上游分支。 如果您尚未准备好创建拉取请求,或者希望在 {% data variables.product.prodname_dotcom %} 上创建拉取请求,则可能需要这样做。
1. At the right side of the navigation bar, click the upward pointing arrow.
1. 在导航栏的右侧,单击向上箭头。
![Screenshot of the push commits upward arrow](/assets/images/help/codespaces/jetbrains-push-button.png)
![“推送提交”向上箭头的屏幕截图](/assets/images/help/codespaces/jetbrains-push-button.png)
1. In the Push Commits dialog box, click **Push**.
1. 在“推送提交”对话框中,单击“推送”。
{% endjetbrains %}

View File

@@ -1,7 +1,7 @@
---
title: 'Deep dive into {% data variables.product.prodname_github_codespaces %}'
title: '深入了解 {% data variables.product.prodname_github_codespaces %}'
shortTitle: 'Deep dive into {% data variables.product.prodname_codespaces %}'
intro: 'Understand how {% data variables.product.prodname_github_codespaces %} works.'
intro: '了解 {% data variables.product.prodname_github_codespaces %} 的工作原理。'
allowTitleToDifferFromFilename: true
versions:
fpt: '*'
@@ -9,151 +9,156 @@ versions:
type: quick_start
topics:
- Codespaces
ms.openlocfilehash: 5f97a137ec09191d5cbaa9c10aa280e10f11bbc0
ms.sourcegitcommit: e8c012864f13f9146e53fcb0699e2928c949ffa8
ms.translationtype: HT
ms.contentlocale: zh-CN
ms.lasthandoff: 11/09/2022
ms.locfileid: '148158643'
---
{% data variables.product.prodname_github_codespaces %} 是一个基于云的即时开发环境,它使用容器为你提供用于开发的通用语言、工具和实用程序。 {% data variables.product.prodname_github_codespaces %} 也是可配置的,通过它可为项目创建自定义的开发环境。 通过为项目配置自定义开发环境,可以为项目的所有用户提供可重复的代码空间配置。
{% data variables.product.prodname_github_codespaces %} is an instant, cloud-based development environment that uses a container to provide you with common languages, tools, and utilities for development. {% data variables.product.prodname_github_codespaces %} is also configurable, allowing you to create a customized development environment for your project. By configuring a custom development environment for your project, you can have a repeatable codespace configuration for all users of your project.
## 创建代码空间
## Creating your codespace
有许多入口点可用于创建代码空间。
There are a number of entry points to create a codespace.
- From a {% data variables.product.company_short %} template or any template repository on {% data variables.product.prodname_dotcom_the_website %} to start a new project
- From a branch in your repository for new feature work
- From an open pull request to explore work-in-progress
- From a commit in a repository's history to investigate a bug at a specific point in time
- 通过 {% data variables.product.company_short %} 模板或 {% data variables.product.prodname_dotcom_the_website %} 上的任何模板存储库启动新项目
- 使用存储库中的分支进行新功能工作
- 使用打开的拉取请求探索正在进行的工作
- 使用存储库历史记录中的提交项调查特定时间点的 bug。
{% data reusables.codespaces.ways-to-create-a-codespace %}
Your codespace can be ephemeral if you need to test something or you can return to the same codespace to work on long-running feature work.
如果需要测试某些内容,则代码空间可以是短暂的,或者可以返回到同一代码空间来处理长时间运行的功能工作。
For more information, see "[Creating a codespace for a repository](/codespaces/developing-in-codespaces/creating-a-codespace-for-a-repository)," "[Creating a codespace from a template](/codespaces/developing-in-codespaces/creating-a-codespace-from-a-template)," and "[Opening an existing codespace](/codespaces/developing-in-codespaces/opening-an-existing-codespace)."
有关详细信息,请参阅“[为存储库创建 codespace](/codespaces/developing-in-codespaces/creating-a-codespace-for-a-repository)”、“[通过模板创建 codespace](/codespaces/developing-in-codespaces/creating-a-codespace-from-a-template)”和“[打开现有 codespace](/codespaces/developing-in-codespaces/opening-an-existing-codespace)”。
{% note %}
**Note**: You can create more than one codespace per repository or even per branch. However, there are limits to the number of codespaces you can create, and the number of codespaces you can run at the same time. If you reach the maximum number of codespaces and try to create another, a message is displayed telling you that you must remove an existing codespace before you can create a new one.
注意:可为每个存储库甚至每个分支创建多个 codespace。 但是,可以创建的 codespace 数量和可以同时运行的 codespace 数量受到限制。 如果达到最大 codespace 数并尝试创建另一个 codespace则会显示一条消息告知你必须删除现有 codespace然后才能创建新的 codespace。
{% endnote %}
### The codespace creation process
### codespace 创建过程
When you create a codespace, various steps happen in the background before the codespace is available to you.
创建 codespace 时,各个步骤将在后台执行,然后 codespace 可供你使用。
### Step 1: VM and storage are assigned to your codespace
### 步骤 1将虚拟机和存储分配给代码空间
When you create a codespace, a [shallow clone](https://github.blog/2020-12-21-get-up-to-speed-with-partial-clone-and-shallow-clone/) is made of your repository, or of the template repository if you're creating a codespace from a template. The repository is cloned to a Linux virtual machine that is both dedicated and private to you. Having a dedicated VM ensures that you have the entire set of compute resources from that machine available to you. If necessary, this also allows you to have full root access to your container.
创建 codespace 时,将创建存储库的[浅克隆](https://github.blog/2020-12-21-get-up-to-speed-with-partial-clone-and-shallow-clone/),如果是通过模板创建 codespace则将创建模板存储库的浅克隆。 存储库将克隆到你的专用 Linux 虚拟机。 拥有专用虚拟机可确保您拥有该计算机中可供使用的整个计算资源集。 如有必要,这还允许您对容器具有完全根访问权限。
### Step 2: Container is created
### 步骤 2创建容器
{% data variables.product.prodname_github_codespaces %} uses a container as the development environment. This container is created based on configurations that you can define in a `devcontainer.json` file and, optionally, a Dockerfile. If you create a codespace from {% data variables.product.company_short %}'s blank template, or from a repository with no `devcontainer.json` file, {% data variables.product.prodname_github_codespaces %} uses a default image, which has many languages and runtimes available. For more information, see "[Introduction to dev containers](/codespaces/setting-up-your-project-for-codespaces/introduction-to-dev-containers)." For details of what the default image contains, see the [`microsoft/vscode-dev-containers`](https://github.com/microsoft/vscode-dev-containers/tree/main/containers/codespaces-linux) repository.
{% data variables.product.prodname_github_codespaces %} 使用容器作为开发环境。 此容器是根据你可以在 `devcontainer.json` 文件以及 Dockerfile可选中定义的配置创建的。 如果通过 {% data variables.product.company_short %} 的空白模板或不包含 `devcontainer.json` 文件的存储库创建 codespace{% data variables.product.prodname_github_codespaces %} 将使用具有多种语言和运行时的默认映像。 有关详细信息,请参阅“[开发容器简介](/codespaces/setting-up-your-project-for-codespaces/introduction-to-dev-containers)”。 若要详细了解默认映像包含的内容,请参阅 [`microsoft/vscode-dev-containers`](https://github.com/microsoft/vscode-dev-containers/tree/main/containers/codespaces-linux) 存储库。
{% note %}
**Note:** If you want to use Git hooks in your codespace and apply anything in the [git template directory](https://git-scm.com/docs/git-init#_template_directory) to your codespace, then you must set up hooks during step 4 after the container is created.
注意:如果要在 codespace 中使用 Git 挂钩,并将 [git 模板目录](https://git-scm.com/docs/git-init#_template_directory)中的任何内容应用于 codespace,则必须在创建容器后在步骤 4 中设置挂钩。
Since your repository is cloned onto the host VM before the container is created, anything in the [git template directory](https://git-scm.com/docs/git-init#_template_directory) will not apply in your codespace unless you set up hooks in your `devcontainer.json` configuration file using the `postCreateCommand` in step 4. For more information, see "[Step 4: Post-creation setup](#step-4-post-creation-setup)."
由于存储库在创建容器之前已克隆到主机 VM 上,因此 [git 模板目录](https://git-scm.com/docs/git-init#_template_directory)中的任何内容都不会应用于 codespace除非你在步骤 4 中使用 `postCreateCommand``devcontainer.json` 配置文件中设置挂钩。 有关详细信息,请参阅“[步骤 4创建后设置](#step-4-post-creation-setup)”。
{% endnote %}
### Step 3: Connecting to the codespace
### 步骤 3连接到代码空间
When your container has been created and any other initialization has run, you'll be connected to your codespace. You can connect to it by using:
创建容器并运行任何其他初始化后,您将连接到代码空间。 可以使用以下方法建立连接:
* Your web browser
* Web 浏览器
* [Visual Studio Code](/codespaces/developing-in-codespaces/using-github-codespaces-in-visual-studio-code)
* [A JetBrains IDE](/codespaces/developing-in-codespaces/using-github-codespaces-in-your-jetbrains-ide)
* [JetBrains IDE](/codespaces/developing-in-codespaces/using-github-codespaces-in-your-jetbrains-ide)
* [{% data variables.product.prodname_cli %}](/codespaces/developing-in-codespaces/using-github-codespaces-with-github-cli)
### Step 4: Post-creation setup
### 步骤 4创建后设置
Once you are connected to your codespace, your automated setup may continue to build based on the configuration specified in your `devcontainer.json` file. You may see `postCreateCommand` and `postAttachCommand` run.
连接到 codespace 后,你的自动设置可能会根据你在 `devcontainer.json` 文件中指定的配置继续构建。 你可能会看到 `postCreateCommand` `postAttachCommand` 运行。
If you want to use Git hooks in your codespace, set up hooks using the [`devcontainer.json` lifecycle scripts](https://code.visualstudio.com/docs/remote/devcontainerjson-reference#_lifecycle-scripts), such as `postCreateCommand`. For more information, see the [`devcontainer.json` reference](https://code.visualstudio.com/docs/remote/devcontainerjson-reference#_devcontainerjson-properties) in the {% data variables.product.prodname_vscode_shortname %} documentation.
如果要在 codespace 中使用 Git 挂钩,请使用 [`devcontainer.json` 生命周期脚本](https://code.visualstudio.com/docs/remote/devcontainerjson-reference#_lifecycle-scripts)设置挂钩,例如 `postCreateCommand`。 有关详细信息,请参阅 {% data variables.product.prodname_vscode_shortname %} 文档中的 [`devcontainer.json` 参考](https://code.visualstudio.com/docs/remote/devcontainerjson-reference#_devcontainerjson-properties)
If you have a public dotfiles repository for {% data variables.product.prodname_github_codespaces %}, you can enable it for use with new codespaces. When enabled, your dotfiles will be cloned to the container and the install script will be invoked. For more information, see "[Personalizing {% data variables.product.prodname_github_codespaces %} for your account](/codespaces/customizing-your-codespace/personalizing-github-codespaces-for-your-account#dotfiles)."
如果你有一个用于 {% data variables.product.prodname_github_codespaces %} 的公共 dotfile 存储库,则可以启用它以用于新的 codespace。 启用后,您的 dotfile 将被克隆到容器中,并且将调用安装脚本。 有关详细信息,请参阅“[为帐户设置个性化的 {% data variables.product.prodname_github_codespaces %}](/codespaces/customizing-your-codespace/personalizing-github-codespaces-for-your-account#dotfiles)”。
Finally, if you created the codespace from a repository, the entire history of the repository is copied down with a full clone. If you created the codespace from a template, the full history of the template repository is not preserved; instead, unless you are using the blank template, you will start with an initial commit for the contents of the template repository.
最后,如果通过存储库创建了 codespace则会使用完整克隆复制存储库的整个历史记录。 如果通过模板创建了 codespace则不会保留模板存储库的完整历史记录除非改为使用空白模板否则将从模板存储库内容的初始提交开始。
During post-creation setup you'll still be able to use the integrated terminal and make edits to your files, but take care to avoid any race conditions between your work and the commands that are running.
## {% data variables.product.prodname_codespaces %} lifecycle
在创建后设置期间,您仍然可以使用集成终端并对文件进行编辑,但要注意避免工作与正在运行的命令之间存在任何争用条件。
## {% data variables.product.prodname_codespaces %} 生命周期
### Saving files in your codespace
### 在代码空间中保存文件
Save changes to files in the normal way, depending on the editor you are using.
根据所用的编辑器以常规方式保存对文件的更改。
If you work on codespaces in {% data variables.product.prodname_vscode %}, you can enable [Auto Save](https://code.visualstudio.com/docs/editor/codebasics#_save-auto-save) to ensure that your changes are always saved.
如果要处理 {% data variables.product.prodname_vscode %} 中的 codespace则可以启用[自动保存](https://code.visualstudio.com/docs/editor/codebasics#_save-auto-save)以确保始终保存所做更改。
### Closing or stopping your codespace
### 关闭或停止代码空间
Your codespace will keep running while you are using it, but will time out after a period of inactivity. File changes from the editor and terminal output are counted as activity, so your codespace will not time out if terminal output is continuing. The default inactivity timeout period is 30 minutes. You can define your personal timeout setting for codespaces you create, but this may be overruled by an organization timeout policy. For more information, see "[Setting your timeout period for Codespaces](/codespaces/customizing-your-codespace/setting-your-timeout-period-for-codespaces)."
使用 codespace 时,它将保持运行,但在处于非活动状态一段时间后会超时。 编辑器和终端输出中的文件更改将计为活动因此如果终端输出继续codespace 将不会超时。 默认非活动超时期限为 30 分钟。 可以为创建的 codespace 定义个人超时设置,但这可能会被组织超时策略覆盖。 有关详细信息,请参阅“[为 codespace 设置超时期限](/codespaces/customizing-your-codespace/setting-your-timeout-period-for-codespaces)”。
If a codespace times out it will stop running, but you can restart it from the browser tab (if you were using the codespace in the browser), from within {% data variables.product.prodname_vscode_shortname %}, or from your list of codespaces at [https://github.com/codespaces](https://github.com/codespaces).
如果 codespace 超时,它将停止运行,但可通过以下方式重启:浏览器选项卡(如果在浏览器中使用 codespace{% data variables.product.prodname_vscode_shortname %}[https://github.com/codespaces](https://github.com/codespaces) 中的 codespace 列表。
To stop your codespace you can
可通过以下方式停止 codespace
* In the browser: on your list of codespaces at [https://github.com/codespaces](https://github.com/codespaces), click the ellipsis (**...**) to the right of the codespace you want to stop and click **Stop codespace**.
* In {% data variables.product.prodname_vscode_shortname %}: open [the {% data variables.product.prodname_vscode_command_palette %}](/codespaces/codespaces-reference/using-the-vs-code-command-palette-in-codespaces#suspending-or-stopping-a-codespace) - for example, by pressing <kbd>Ctrl</kbd>+<kbd>Shift</kbd>+<kbd>Enter</kbd> (Windows/Linux) or <kbd>Shift</kbd>+<kbd>Command</kbd>+<kbd>P</kbd> (Mac) - type `Codespaces: stop` then press <kbd>Enter</kbd>.
* In the JetBrains client, click the stop button at the top of the {% data variables.product.prodname_github_codespaces %} tool window. For more information, see the "JetBrains IDEs" tab of "[Stopping and starting a codespace](/codespaces/developing-in-codespaces/stopping-and-starting-a-codespace)."
* In a terminal window: use the {% data variables.product.prodname_cli %} command `gh codespace stop`. For more information, see "[Using {% data variables.product.prodname_github_codespaces %} with {% data variables.product.prodname_cli %}](/codespaces/developing-in-codespaces/using-github-codespaces-with-github-cli#gh-commands-for-github-codespaces)."
* 浏览器:在 [https://github.com/codespaces](https://github.com/codespaces) 的 codespace 列表中,单击要停止的 codespace 右侧的省略号 (…),然后单击“停止 codespace” 。
* {% data variables.product.prodname_vscode_shortname %}:打开 [the {% data variables.product.prodname_vscode_command_palette %}](/codespaces/codespaces-reference/using-the-vs-code-command-palette-in-codespaces#suspending-or-stopping-a-codespace) - 例如,按 <kbd>Ctrl</kbd>+<kbd>Shift</kbd>+<kbd>Enter</kbd> (Windows/Linux) <kbd>Shift</kbd>+<kbd>Command</kbd>+<kbd>P</kbd> (Mac),键入 `Codespaces: stop`,然后按 <kbd>Enter</kbd>
* JetBrains 客户端:单击 {% data variables.product.prodname_github_codespaces %} 工具窗口顶部的停止按钮。 有关详细信息,请参阅“[停止和启动 codespace](/codespaces/developing-in-codespaces/stopping-and-starting-a-codespace)”的“JetBrains IDE”选项卡。
* 终端窗口:使用 {% data variables.product.prodname_cli %} 命令 `gh codespace stop`。 有关详细信息,请参阅“[ {% data variables.product.prodname_github_codespaces %} {% data variables.product.prodname_cli %} 配合使用](/codespaces/developing-in-codespaces/using-github-codespaces-with-github-cli#gh-commands-for-github-codespaces)
If you exit your codespace without running the stop command (for example, by closing the browser tab), or if you leave the codespace running without interaction, the codespace and its running processes will continue for the duration of the inactivity timeout period.
如果在未运行停止命令的情况下退出 codespace例如关闭浏览器选项卡或者让 codespace 在没有交互的情况下运行,则代码空间及其正在运行的进程将在非活动超时期限内继续运行。
When you close or stop your codespace, all uncommitted changes are preserved until you connect to the codespace again.
关闭或停止代码空间时,将保留所有未提交的更改,直到您再次连接到代码空间。
## Running your application
## 运行应用程序
Port forwarding gives you access to TCP ports running within your codespace. For example, if you're running a web application on port 4000 within your codespace, you can automatically forward that port to make the application accessible from your browser.
通过端口转发,您可以访问在代码空间内运行的 TCP 端口。 例如,如果要在代码空间内的端口 4000 上运行 Web 应用程序,则可以自动转发该端口,以使该应用程序可从浏览器访问。
Port forwarding determines which ports are made accessible to you from the remote machine. Even if you do not forward a port, that port is still accessible to other processes running inside the codespace itself.
端口转发确定可从远程计算机访问哪些端口。 即使不转发端口,在代码空间本身内运行的其他进程仍然可以访问该端口。
![Diagram showing how port forwarding works in a codespace](/assets/images/help/codespaces/port-forwarding.png)
![显示端口转发在代码空间中的工作方式的图示](/assets/images/help/codespaces/port-forwarding.png)
When an application running inside {% data variables.product.prodname_github_codespaces %} outputs a port to the console, {% data variables.product.prodname_github_codespaces %} detects the localhost URL pattern and automatically forwards the port. You can click on the URL in the terminal, or the link in the "toast" notification message that pops up at the bottom right corner of {% data variables.product.prodname_vscode_shortname %}, to open the port in a browser. By default, {% data variables.product.prodname_github_codespaces %} forwards the port using HTTP. For more information on port forwarding, see "[Forwarding ports in your codespace](/codespaces/developing-in-codespaces/forwarding-ports-in-your-codespace)."
当在 {% data variables.product.prodname_github_codespaces %} 内运行的应用程序将端口输出到控制台时,{% data variables.product.prodname_github_codespaces %} 会检测 localhost URL 模式并自动转发该端口。 可以单击终端中的 URL或单击 {% data variables.product.prodname_vscode_shortname %} 右下角弹出的“toast”通知消息中的链接在浏览器中打开端口。 默认情况下,{% data variables.product.prodname_github_codespaces %} 使用 HTTP 转发端口。 有关端口转发的详细信息,请参阅“[ codespace 中转发端口](/codespaces/developing-in-codespaces/forwarding-ports-in-your-codespace)”。
While ports can be forwarded automatically, they are not publicly accessible to the internet. By default, all ports are private, but you can manually make a port available to your organization or public, and then share access through a URL. For more information, see "[Sharing a port](/codespaces/developing-in-codespaces/forwarding-ports-in-your-codespace#sharing-a-port)."
虽然端口可以自动转发,但它们不能被互联网公开访问。 默认情况下,所有端口都是私有的,但您可以手动使端口可供您的组织或公共使用,然后通过 URL 共享访问权限。 有关详细信息,请参阅“[共享端口](/codespaces/developing-in-codespaces/forwarding-ports-in-your-codespace#sharing-a-port)”。
Running your application when you first land in your codespace can make for a fast inner dev loop. As you edit, your changes are automatically saved and available on your forwarded port. To view changes, go back to the running application tab in your browser and refresh it.
首次登录代码空间时运行应用程序可以实现快速的内部开发循环。 编辑时,您的更改会自动保存,并可在转发的端口上使用。 要查看更改,请返回浏览器中正在运行的应用程序选项卡并刷新它。
## Committing and pushing your changes
## 提交和推送更改
Git is installed by default in your codespace and so you can rely on your existing Git workflow. You can work with Git in your codespace either via the Terminal or by using the source control features of {% data variables.product.prodname_vscode_shortname %} or JetBrains.
默认情况下Git 安装在 codespace 中,因此你可以依赖现有的 Git 工作流。 你可以通过终端或者使用 {% data variables.product.prodname_vscode_shortname %} JetBrains 的源代码管理功能在 codespace 中使用 Git。
If you're working with an existing repository, you can create a codespace from any branch, commit, or pull request in the repository, or you can switch to a new or existing branch from within your active codespace. Because {% data variables.product.prodname_github_codespaces %} is designed to be ephemeral, you can use it as an isolated environment to experiment, check a teammate's pull request, or fix merge conflicts.
如果使用的是现有存储库,则可使用项目中的任何分支、提交或拉取请求创建 codespace也可以从活动 codespace 中切换到新的或现有的分支。 由于 {% data variables.product.prodname_github_codespaces %} 设计为临时的,因此你可以将其用作隔离环境来试验、检查团队成员的拉取请求或修复合并冲突。
If you're working in a codespace created from a template, Git will be installed by default, but you will need to publish your codespace to a remote repository to persist your work and to share it with others. If you start from {% data variables.product.company_short %}'s blank template, you will first need to initialize your workspace as a Git repository (for example by entering `git init`) to start using source control within the codespace.
如果使用的是通过模板创建的 codespace则默认情况下将安装 Git但需要将 codespace 发布到远程存储库,以保留工作并与其他人共享。 如果通过 {% data variables.product.company_short %} 的空白模板开始,则首先需要将工作区初始化为 Git 存储库(例如输入 `git init`),才能在 codespace 中开始使用源代码管理功能。
For more information, see "[Using source control in your codespace](/codespaces/developing-in-codespaces/using-source-control-in-your-codespace)."
有关详细信息,请参阅[ codespace 中使用源代码管理](/codespaces/developing-in-codespaces/using-source-control-in-your-codespace)
{% note %}
**Note:** Commits from your codespace will be attributed to the name and public email configured at https://github.com/settings/profile. A token scoped to the repository, included in the environment as `GITHUB_TOKEN`, and your GitHub credentials will be used to authenticate.
注意:来自 codespace 的提交将属性化为在 https://github.com/settings/profile 配置的名称和公共电子邮件。 范围限定为存储库的令牌(作为 `GITHUB_TOKEN` 包含在环境中),你的 GitHub 凭据将用于身份验证。
{% endnote %}
## Personalizing your codespace with extensions or plugins
## 使用扩展或插件个性化 codespace
You can add plugins and extensions within a codespace to personalize your experience in JetBrains and {% data variables.product.prodname_vscode_shortname %} respectively.
可以在 codespace 中添加插件和扩展,分别对在 JetBrains {% data variables.product.prodname_vscode_shortname %} 中的体验进行个性化设置。
### {% data variables.product.prodname_vscode_shortname %} extensions
### {% data variables.product.prodname_vscode_shortname %} 扩展
If you work on your codespaces in the {% data variables.product.prodname_vscode_shortname %} desktop application, or the web client, you can add any extensions you need from the {% data variables.product.prodname_vscode_marketplace %}. For information on how extensions run in {% data variables.product.prodname_github_codespaces %}, see [Supporting Remote Development and {% data variables.product.prodname_github_codespaces %}](https://code.visualstudio.com/api/advanced-topics/remote-extensions) in the {% data variables.product.prodname_vscode_shortname %} documentation.
如果在 {% data variables.product.prodname_vscode_shortname %} 桌面应用程序或 Web 客户端中使用 codespace则可使用 {% data variables.product.prodname_vscode_marketplace %} 添加所需的任何扩展。 若要了解扩展如何在 {% data variables.product.prodname_github_codespaces %} 中运行,请参阅 {% data variables.product.prodname_vscode_shortname %} 文档中的[支持远程开发和 {% data variables.product.prodname_github_codespaces %}](https://code.visualstudio.com/api/advanced-topics/remote-extensions)
If you already use {% data variables.product.prodname_vscode_shortname %}, you can use [Settings Sync](https://code.visualstudio.com/docs/editor/settings-sync) to automatically sync extensions, settings, themes, and keyboard shortcuts between your local instance and any codespaces you create.
如果你已使用 {% data variables.product.prodname_vscode_shortname %},则可以使用[设置同步](https://code.visualstudio.com/docs/editor/settings-sync)在本地实例和你创建的任何 codespace 之间自动同步扩展、设置、主题和键盘快捷方式。
### JetBrains plugins
### JetBrains 插件
If you work on your codespaces in a JetBrains IDE, you can add plugins from the JetBrains Marketplace.
如果在 JetBrains IDE 中使用 codespace则可使用 JetBrains Marketplace 添加插件。
1. Click **JetBrains Client**, then click **Preferences**.
1. In the Preferences dialog box, click either **Plugins On Host** to install a plugin in the full JetBrains IDE that's running remotely, or **Plugins** to install a plugin on the local client, for example to change the user interface theme.
1. Click the **Marketplace** tab.
1. 单击 JetBrains 客户端,然后单击“首选项” 。
1. 在“首选项”对话框中,单击“主机插件”可在远程运行的完整 JetBrains IDE 中安装插件,或单击“插件”可在本地客户端上安装插件,例如更改用户界面主题 。
1. 单击“市场”选项卡。
![Screenshot of the Marketplace tab for 'Plugins On Host'](/assets/images/help/codespaces/jetbrains-preferences-plugins.png)
![“主机插件”的“市场”选项卡的屏幕截图](/assets/images/help/codespaces/jetbrains-preferences-plugins.png)
1. Click **Install** beside the required plugin.
1. 单击所需插件旁边的“安装”。
## Further reading
## 延伸阅读
- "[Enabling {% data variables.product.prodname_github_codespaces %} for your organization](/codespaces/managing-codespaces-for-your-organization/enabling-github-codespaces-for-your-organization)"
- "[Managing the cost of {% data variables.product.prodname_github_codespaces %} in your organization](/codespaces/managing-codespaces-for-your-organization/managing-the-cost-of-github-codespaces-in-your-organization)"
- "[Add a dev container configuration to your repository](/codespaces/setting-up-your-project-for-codespaces/setting-up-your-project-for-codespaces)"
- "[The codespace lifecycle](/codespaces/developing-in-codespaces/the-codespace-lifecycle)"
- [为组织启用 {% data variables.product.prodname_github_codespaces %}](/codespaces/managing-codespaces-for-your-organization/enabling-github-codespaces-for-your-organization)
- [管理组织中的 {% data variables.product.prodname_github_codespaces %} 成本](/codespaces/managing-codespaces-for-your-organization/managing-the-cost-of-github-codespaces-in-your-organization)
- [将开发容器配置添加到存储库](/codespaces/setting-up-your-project-for-codespaces/setting-up-your-project-for-codespaces)
- [codespace 生命周期](/codespaces/developing-in-codespaces/the-codespace-lifecycle)

View File

@@ -1,7 +1,7 @@
---
title: 'Quickstart for {% data variables.product.prodname_github_codespaces %}'
title: '{% data variables.product.prodname_github_codespaces %} 快速入门'
shortTitle: 'Quickstart for {% data variables.product.prodname_codespaces %}'
intro: 'Try out {% data variables.product.prodname_github_codespaces %} in 5 minutes.'
intro: '在 5 分钟内试用 {% data variables.product.prodname_github_codespaces %}'
allowTitleToDifferFromFilename: true
versions:
fpt: '*'
@@ -11,103 +11,108 @@ topics:
- Codespaces
redirect_from:
- /codespaces/codespaces-quickstart
ms.openlocfilehash: f35fa87711ff3a7c33ed252d0d1e87865af619bc
ms.sourcegitcommit: e8c012864f13f9146e53fcb0699e2928c949ffa8
ms.translationtype: HT
ms.contentlocale: zh-CN
ms.lasthandoff: 11/09/2022
ms.locfileid: '148158651'
---
## 简介
## Introduction
在本指南中,你将从模板存储库创建 codespace并探索 codespace 中可用的一些基本功能。 你将使用 {% data variables.product.prodname_vscode %} 的浏览器版本,该版本最初是 {% data variables.product.prodname_github_codespaces %} 的默认编辑器。 尝试本快速入门后,可以在其他编辑器中使用 {% data variables.product.prodname_codespaces %},并且可以更改默认编辑器。 本指南末尾提供了相关链接。
In this guide, you'll create a codespace from a template repository and explore some of the essential features available to you within the codespace. You'll work in the browser version of {% data variables.product.prodname_vscode %}, which is initially the default editor for {% data variables.product.prodname_github_codespaces %}. After trying out this quickstart you can use {% data variables.product.prodname_codespaces %} in other editors, and you can change the default editor. Links are provided at the end of this guide.
在本快速入门中,你将了解如何创建 codespace、连接到转发的端口以查看正在运行的应用程序、将 codespace 发布到一个新的存储库,以及通过扩展实现设置个性化。
From this quickstart, you'll learn how to create a codespace, connect to a forwarded port to view your running application, publish your codespace to a new repository, and personalize your setup with extensions.
有关 {% data variables.product.prodname_github_codespaces %} 如何工作的详细信息,请参阅配套指南“[深入了解 {% data variables.product.prodname_github_codespaces %}](/codespaces/getting-started/deep-dive)”。
For more information on exactly how {% data variables.product.prodname_github_codespaces %} works, see the companion guide "[Deep dive into {% data variables.product.prodname_github_codespaces %}](/codespaces/getting-started/deep-dive)."
## 创建代码空间
## Creating your codespace
1. Navigate to the [github/haikus-for-codespaces](https://github.com/github/haikus-for-codespaces) template repository.
1. 导航到 [github/haikus-for-codespaces](https://github.com/github/haikus-for-codespaces) 模板存储库。
{% data reusables.codespaces.open-template-in-codespace-step %}
## Running the application
## 运行应用程序
Once your codespace is created, the template repository will be automatically cloned into it. Now you can run the application and launch it in a browser.
创建 codespace 后,模板存储库将自动克隆到其中。 现在,您可以运行该应用程序并在浏览器中启动它。
1. When the terminal becomes available, enter the command `npm run dev`. This example uses a Node.js project, and this command runs the script labeled "dev" in the `package.json` file, which starts up the web application defined in the sample repository.
1. 当终端可用时,输入命令 `npm run dev`。 此示例使用 Node.js 项目,此命令运行 `package.json` 文件中标记为“dev”的脚本该脚本启动示例存储库中定义的 Web 应用程序。
![npm run dev in terminal](/assets/images/help/codespaces/codespaces-npm-run-dev.png)
![终端中的 npm run dev](/assets/images/help/codespaces/codespaces-npm-run-dev.png)
If you're following along with a different application type, enter the corresponding start command for that project.
如果按照其他应用程序类型进行操作,请为该项目输入相应的启动命令。
2. When your application starts, the codespace recognizes the port the application is running on and displays a prompt to let you know it has been forwarded.
2. 当应用程序启动时codespace 会识别运行应用程序的端口,并显示该端口已转发的提示。
![Port forwarding "toast" notification](/assets/images/help/codespaces/quickstart-port-toast.png)
![端口转发“toast”通知](/assets/images/help/codespaces/quickstart-port-toast.png)
3. Click **Open in Browser** to view your running application in a new tab.
3. 单击“在浏览器中打开”,在新选项卡中查看正在运行的应用程序。
## Edit the application and view changes
## 编辑应用程序并查看更改
1. Switch back to your codespace and open the `haikus.json` file by clicking it in the Explorer.
1. 切换回 codespace并通过在文件资源管理器中单击 `haikus.json` 文件来打开该文件。
2. Edit the `text` field of the first haiku to personalize the application with your own haiku.
2. 编辑第一个俳句的 `text` 字段,从而使用自己的俳句个性化应用程序。
3. Go back to the running application tab in your browser and refresh to see your changes.
3. 返回到浏览器中正在运行的应用程序选项卡,然后刷新以查看所做的更改。
{% octicon "light-bulb" aria-label="The lightbulb icon" %} If you've closed the tab, open the Ports panel and click the **Open in browser** icon for the running port.
{% octicon "light-bulb" aria-label="The lightbulb icon" %} 如果已关闭选项卡,请打开“端口”面板,然后针对运行的端口单击“在浏览器中打开”图标。
![Port Forwarding Panel](/assets/images/help/codespaces/quickstart-forward-port.png)
![端口转发面板](/assets/images/help/codespaces/quickstart-forward-port.png)
## Committing and pushing your changes
## 提交和推送更改
Now that you've made a few changes, you can use the integrated terminal or the source view to publish your work to a new repository.
现在,你已经进行了一些更改,可以使用集成终端或源视图将工作发布到新的存储库。
{% data reusables.codespaces.source-control-display-dark %}
1. To stage your changes, click **+** next to the `haikus.json` file, or next to **Changes** if you've changed multiple files and you want to stage them all.
1. 若要暂存更改,请单击 `haikus.json` 文件旁边的 +,如果你更改了多个文件并希望全部暂存,请单击“更改”旁边的按钮 。
![Source control side bar with staging button highlighted](/assets/images/help/codespaces/codespaces-commit-stage.png)
![突出显示的暂存按钮的源代码管理侧栏](/assets/images/help/codespaces/codespaces-commit-stage.png)
2. To commit your staged changes, type a commit message describing the change you've made, then click **Commit**.
2. 若要提交暂存更改,请键入描述所做更改的提交消息,然后单击“提交”。
![Source control side bar with a commit message](/assets/images/help/codespaces/vscode-commit-button.png)
![包含提交消息的源代码管理侧栏](/assets/images/help/codespaces/vscode-commit-button.png)
3. Click **Publish Branch**.
3. 单击“发布分支”。
![Screenshot of the "Publish branch" button in VS Code](/assets/images/help/codespaces/vscode-publish-branch-button.png)
![VS Code 中“发布分支”按钮的屏幕截图](/assets/images/help/codespaces/vscode-publish-branch-button.png)
4. In the "Repository Name" dropdown, type a name for your new repository, then select **Publish to {% data variables.product.company_short %} private repository** or **Publish to {% data variables.product.company_short %} public repository**.
4. 在“存储库名称”下拉列表中,键入新存储库的名称,然后选择“发布到 {% data variables.product.company_short %} 专用存储库”或“发布到 {% data variables.product.company_short %} 公共存储库”。
![Screenshot of the "Repository Name" dropdown in VS Code](/assets/images/help/codespaces/choose-new-repository.png)
![VS Code 中“存储库名称”下拉列表的屏幕截图](/assets/images/help/codespaces/choose-new-repository.png)
The owner of the new repository will be the {% data variables.product.prodname_dotcom %} account with which you created the codespace.
5. In the pop-up that appears in the lower right corner of the editor, click **Open on {% data variables.product.company_short %}** to view the new repository on {% data variables.product.prodname_dotcom_the_website %}. In the new repository, view the `haikus.json` file and check that the change you made in your codespace has been successfully pushed to the repository.
新存储库的所有者将是创建 codespace 时所使用的 {% data variables.product.prodname_dotcom %} 帐户。
5. 在编辑器右下角显示的弹出窗口中,单击“在 {% data variables.product.company_short %} 上打开”,查看 {% data variables.product.prodname_dotcom_the_website %} 上的新存储库。 在新存储库中,查看 `haikus.json` 文件,并检查 codespace 中所做的更改是否已成功推送到存储库。
![Screenshot of the "Open in GitHub" pop-up in VS Code](/assets/images/help/codespaces/open-on-github.png)
![VS Code 中“在 GitHub 中打开”弹出窗口的屏幕截图](/assets/images/help/codespaces/open-on-github.png)
## Personalizing with an extension
## 使用扩展进行个性化设置
When you connect to a codespace using the browser, or the {% data variables.product.prodname_vscode %} desktop application, you can access the Visual Studio Code Marketplace directly from the editor. For this example, you'll install a {% data variables.product.prodname_vscode_shortname %} extension that alters the theme, but you can install any extension that's useful for your workflow.
使用浏览器或 {% data variables.product.prodname_vscode %} 桌面应用程序连接到 codespace 时,可以直接从编辑器访问 Visual Studio Code 市场。 在本示例中,你将安装可更改主题的 {% data variables.product.prodname_vscode_shortname %} 扩展,但也可以安装对工作流程有用的任何扩展。
1. In the left sidebar, click the Extensions icon.
1. In the search bar, type `fairyfloss` and click **Install**.
1. 在左侧栏中,单击扩展图标。
1. 在搜索栏中,键入 `fairyfloss` 并单击“安装”。
![Add an extension](/assets/images/help/codespaces/add-extension.png)
![添加扩展](/assets/images/help/codespaces/add-extension.png)
1. Select the `fairyfloss` theme by selecting it from the list.
1. 从列表中选择 `fairyfloss` 主题。
![Select the fairyfloss theme](/assets/images/help/codespaces/fairyfloss.png)
![选择 fairyfloss 主题](/assets/images/help/codespaces/fairyfloss.png)
If you are using a codespace in the browser, or in the {% data variables.product.prodname_vscode %} desktop application, and you have [Settings Sync](https://code.visualstudio.com/docs/editor/settings-sync) turned on, any changes you make to your editor setup in the current codespace, such as changing your theme or keyboard bindings, are automatically synced to any instances of {% data variables.product.prodname_vscode %} that are signed into your {% data variables.product.prodname_dotcom %} account and to any other codespaces you create.
如果你在浏览器或 {% data variables.product.prodname_vscode %} 桌面应用程序中使用 codespace并且已打开[“设置同步”](https://code.visualstudio.com/docs/editor/settings-sync),则在当前 codespace 中对编辑器设置所做的任何更改(例如更改主题或键盘绑定),将自动同步到已登录到 {% data variables.product.prodname_dotcom %} 帐户的任何 {% data variables.product.prodname_vscode %} 实例以及你创建的任何其他 codespace 中。
## Next steps
## 后续步骤
You've successfully created, personalized, and run your first application within a codespace but there's so much more to explore! Here are some helpful resources for taking your next steps with {% data variables.product.prodname_github_codespaces %}.
您已经成功创建、个性化并在代码空间中运行了第一个应用程序,但还有很多需要探索的地方! 以下是一些有用的资源,可以帮助你对 {% data variables.product.prodname_github_codespaces %} 执行后续步骤。
* "[Deep dive](/codespaces/getting-started/deep-dive)": This quickstart presented some of the features of {% data variables.product.prodname_github_codespaces %}. The deep dive looks at these areas from a technical standpoint.
* "[Add a dev container configuration to your repository](/codespaces/setting-up-your-project-for-codespaces/setting-up-your-project-for-codespaces)": These guides provide information on setting up your repository to use {% data variables.product.prodname_github_codespaces %} with specific languages.
* "[Introduction to dev containers](/codespaces/setting-up-your-project-for-codespaces/introduction-to-dev-containers)": This guide provides details on creating a custom configuration for {% data variables.product.prodname_codespaces %} for your project.
* [深入探讨](/codespaces/getting-started/deep-dive)”:本快速入门介绍了 {% data variables.product.prodname_github_codespaces %} 的一些功能。 从技术角度深入探讨这些领域。
* [将开发容器配置添加到存储库](/codespaces/setting-up-your-project-for-codespaces/setting-up-your-project-for-codespaces)”:这些指南提供有关设置存储库以将 {% data variables.product.prodname_github_codespaces %} 用于特定语言的信息。
* [开发容器简介](/codespaces/setting-up-your-project-for-codespaces/introduction-to-dev-containers)”:该指南提供有关创建用于项目的 {% data variables.product.prodname_codespaces %} 的自定义配置的详细信息。
## Further reading
## 延伸阅读
* "[Enabling {% data variables.product.prodname_github_codespaces %} for your organization](/codespaces/managing-codespaces-for-your-organization/enabling-github-codespaces-for-your-organization)"
* "[Using {% data variables.product.prodname_github_codespaces %} in {% data variables.product.prodname_vscode %}](/codespaces/developing-in-codespaces/using-github-codespaces-in-visual-studio-code)"
* "[Using {% data variables.product.prodname_github_codespaces %} in your JetBrains IDE](/codespaces/developing-in-codespaces/using-github-codespaces-in-your-jetbrains-ide)"
* "[Using {% data variables.product.prodname_github_codespaces %} with {% data variables.product.prodname_cli %}](/codespaces/developing-in-codespaces/using-github-codespaces-with-github-cli)"
* "[Setting your default editor for {% data variables.product.prodname_github_codespaces %}](/codespaces/customizing-your-codespace/setting-your-default-editor-for-github-codespaces)."
* "[Managing the cost of {% data variables.product.prodname_github_codespaces %} in your organization](/codespaces/managing-codespaces-for-your-organization/managing-the-cost-of-github-codespaces-in-your-organization)"
* [为组织启用 {% data variables.product.prodname_github_codespaces %}](/codespaces/managing-codespaces-for-your-organization/enabling-github-codespaces-for-your-organization)
* [使用 {% data variables.product.prodname_vscode %} 中的 {% data variables.product.prodname_github_codespaces %}](/codespaces/developing-in-codespaces/using-github-codespaces-in-visual-studio-code)
* [在 JetBrains IDE 中使用 {% data variables.product.prodname_github_codespaces %}](/codespaces/developing-in-codespaces/using-github-codespaces-in-your-jetbrains-ide)
* [ {% data variables.product.prodname_github_codespaces %} {% data variables.product.prodname_cli %} 配合使用](/codespaces/developing-in-codespaces/using-github-codespaces-with-github-cli)
* [ {% data variables.product.prodname_github_codespaces %} 设置默认编辑器](/codespaces/customizing-your-codespace/setting-your-default-editor-for-github-codespaces)”。
* [管理组织中的 {% data variables.product.prodname_github_codespaces %} 成本](/codespaces/managing-codespaces-for-your-organization/managing-the-cost-of-github-codespaces-in-your-organization)

View File

@@ -1,8 +1,8 @@
---
title: Enabling GitHub Codespaces for your organization
title: 为组织启用 GitHub Codespaces
shortTitle: 'Enable {% data variables.product.prodname_codespaces %}'
intro: "You can control which users in your organization can use {% data variables.product.prodname_github_codespaces %} at the organization's expense."
permissions: "To alter an organization's billing settings, you must be an organization owner."
intro: '你可以控制组织中的哪些用户可以使用 {% data variables.product.prodname_github_codespaces %}(费用由组织承担)。'
permissions: 'To alter an organization''s billing settings, you must be an organization owner.'
redirect_from:
- /codespaces/managing-codespaces-for-your-organization/managing-user-permissions-for-your-organization
- /codespaces/managing-codespaces-for-your-organization/enabling-codespaces-for-your-organization
@@ -14,70 +14,69 @@ topics:
- Codespaces
- Billing
- Administrator
ms.openlocfilehash: 992d744e04ae00db4d760b59a9d08d1700846998
ms.sourcegitcommit: e8c012864f13f9146e53fcb0699e2928c949ffa8
ms.translationtype: HT
ms.contentlocale: zh-CN
ms.lasthandoff: 11/09/2022
ms.locfileid: '148158899'
---
## 关于为组织启用 {% data variables.product.prodname_github_codespaces %}
## About enabling {% data variables.product.prodname_github_codespaces %} for your organization
组织所有者可以控制组织中的哪些用户可以创建和使用 codespace费用由组织承担。 有关定价的信息,请参阅“[关于 {% data variables.product.prodname_github_codespaces %} 的计费](/billing/managing-billing-for-github-codespaces/about-billing-for-github-codespaces)”。
Organization owners can control which users in your organization can create and use codespaces at the organization's expense. For information about pricing, see "[About billing for {% data variables.product.prodname_github_codespaces %}](/billing/managing-billing-for-github-codespaces/about-billing-for-github-codespaces)."
只有可以将更改推送到存储库或创建存储库分支的人才能为该存储库创建 codespace。 若要允许人们为组织拥有的存储库创建 codespace必须
Only people who can either push changes to a repository, or fork the repository, can create a codespace for that repository. To allow people to create codespaces for repositories owned by your organization, you must:
- 确保用户对他们要在其中使用代码空间的存储库至少具有写入权限。 有关详细信息,请参阅“[管理有权访问存储库的团队和人员](/repositories/managing-your-repositorys-settings-and-features/managing-repository-settings/managing-teams-and-people-with-access-to-your-repository)”。
- 确保您的组织未启用 IP 地址允许列表。 有关详细信息,请参阅 {% data variables.product.prodname_ghe_cloud %} 文档中的“[管理组织允许的 IP 地址](/{% ifversion fpt %}enterprise-cloud@latest/{% endif %}organizations/keeping-your-organization-secure/managing-allowed-ip-addresses-for-your-organization){% ifversion fpt %}”。{% else %}."{% endif %}
- Ensure that users have at least write access to the repositories where they want to use a codespace. For more information, see "[Managing teams and people with access to your repository](/repositories/managing-your-repositorys-settings-and-features/managing-repository-settings/managing-teams-and-people-with-access-to-your-repository)."
- Ensure that your organization does not have an IP address allow list enabled. For more information, see "[Managing allowed IP addresses for your organization](/{% ifversion fpt %}enterprise-cloud@latest/{% endif %}organizations/keeping-your-organization-secure/managing-allowed-ip-addresses-for-your-organization){% ifversion fpt %}" in the {% data variables.product.prodname_ghe_cloud %} documentation.{% else %}."{% endif %}
若要允许人们创建会对组织进行计费的 codespace必须
To allow people to create codespaces for which your organization will be billed, you must:
- [设置支出限制](/billing/managing-billing-for-github-codespaces/managing-spending-limits-for-codespaces)
- [选择可以创建会对组织进行计费的 codespace 的人员](#choose-who-can-create-codespaces-that-are-billed-to-your-organization)
- [Set a spending limit](/billing/managing-billing-for-github-codespaces/managing-spending-limits-for-codespaces)
- [Choose who can create codespaces that are billed to your organization](#choose-who-can-create-codespaces-that-are-billed-to-your-organization)
{% ifversion fpt %} {% note %}
{% ifversion fpt %}
{% note %}
注意:如果你是经过验证的教师或老师,则必须从 {% data variables.product.prodname_classroom %} 启用 {% data variables.product.prodname_github_codespaces %} 来使用 {% data variables.product.prodname_codespaces %} 教育权益。 有关详细信息,请参阅“[将 {% data variables.product.prodname_github_codespaces %} 与 {% data variables.product.prodname_classroom %} 配合使用](/education/manage-coursework-with-github-classroom/integrate-github-classroom-with-an-ide/using-github-codespaces-with-github-classroom#about-the-codespaces-education-benefit-for-verified-teachers)”。
**Note:** If you are a verified educator or a teacher, you must enable {% data variables.product.prodname_github_codespaces %} from a {% data variables.product.prodname_classroom %} to use your {% data variables.product.prodname_codespaces %} Education benefit. For more information, see "[Using {% data variables.product.prodname_github_codespaces %} with {% data variables.product.prodname_classroom %}](/education/manage-coursework-with-github-classroom/integrate-github-classroom-with-an-ide/using-github-codespaces-with-github-classroom#about-the-codespaces-education-benefit-for-verified-teachers)."
{% endnote %} {% endif %}
{% endnote %}
{% endif %}
默认情况下,代码空间只能访问从中创建它的存储库。 如果希望组织中的 codespace 能够访问 codespace 创建者可以访问的其他组织存储库,请参阅“[管理组织 codespace 的存储库访问](/codespaces/managing-codespaces-for-your-organization/managing-repository-access-for-your-organizations-codespaces)”。
By default, a codespace can only access the repository from which it was created. If you want codespaces in your organization to be able to access other organization repositories that the codespace creator can access, see "[Managing repository access for your organization's codespaces](/codespaces/managing-codespaces-for-your-organization/managing-repository-access-for-your-organizations-codespaces)."
## 选择可以创建会对组织进行计费的 codespace 的人员
## Choose who can create codespaces that are billed to your organization
{% data reusables.profile.access_org %} {% data reusables.profile.org_settings %} {% data reusables.organizations.click-codespaces %}
1. 在“计费”下,择以下选项之一:
{% data reusables.profile.access_org %}
{% data reusables.profile.org_settings %}
{% data reusables.organizations.click-codespaces %}
1. Under "Billing," select one of the following options:
* 已禁用 - 不会因使用 codespace 对组织进行计费。 为组织存储库创建的 {% data variables.product.prodname_codespaces %} 会向创建它们的个人用户进行计费。
* 所选成员 - 由所选成员为组织存储库创建的 {% data variables.product.prodname_codespaces %} 会对组织进行计费。
* 所有成员 - 由组织成员为组织存储库创建的 {% data variables.product.prodname_codespaces %} 会对组织进行计费。
* 所有成员和外部协作者 - 由组织成员和外部协作者为组织存储库创建的 {% data variables.product.prodname_codespaces %} 会对组织进行计费。
* **Disabled** - Your organization will not be charged for codespace usage. {% data variables.product.prodname_codespaces %} created for your organization's repositories will be billed to the individual users who create them.
* **Selected members** - {% data variables.product.prodname_codespaces %} created for your organization's repositories by selected members will be billed to the organization.
* **All members** - {% data variables.product.prodname_codespaces %} created for your organization's repositories by members of your organization will be billed to the organization.
* **All members and outside collaborators** - {% data variables.product.prodname_codespaces %} created for your organization's repositories by organization members and outside collaborators will be billed to the organization.
![Radio buttons for "Billing"](/assets/images/help/codespaces/codespaces-org-billing-settings.png)
![“计费”的单选按钮](/assets/images/help/codespaces/codespaces-org-billing-settings.png)
{% note %}
**Note:** When you select **All members and outside collaborators**, all outside collaborators who have been added to specific repositories can create and use {% data variables.product.prodname_codespaces %} for those repositories, and your organization will be billed for this usage. For more information on managing outside collaborators, see "[About outside collaborators](/organizations/managing-access-to-your-organizations-repositories/adding-outside-collaborators-to-repositories-in-your-organization#about-outside-collaborators)."
注意:选择“所有成员和外部协作者”时,所有已添加到特定存储库的外部协作者都可以对这些存储库创建和使用 {% data variables.product.prodname_codespaces %},这种使用会对组织进行计费。 有关管理外部协作者的详细信息,请参阅“[关于外部协作者](/organizations/managing-access-to-your-organizations-repositories/adding-outside-collaborators-to-repositories-in-your-organization#about-outside-collaborators)”。
{% endnote %}
1. Click **Save**.
1. If you chose **Selected members**, an input box is displayed for you to enter the names of users you want to select.
1. 单击“ **保存**”。
1. 如果选择了“所选成员”,则会显示一个输入框,以供你输入要选择的用户的名称。
![Input box for selecting users](/assets/images/help/codespaces/codespaces-org-billing-add-users.png)
![用于选择用户的输入框](/assets/images/help/codespaces/codespaces-org-billing-add-users.png)
## Disabling {% data variables.product.prodname_codespaces %} for your organization
## 为组织禁用 {% data variables.product.prodname_codespaces %}
You can prevent the creation and use of codespaces billable to your organization.
可以阻止创建和使用可对组织进行计费的 codespace。
{% data reusables.codespaces.codespaces-disabling-org-billing %}
{% data reusables.profile.access_org %}
{% data reusables.profile.org_settings %}
{% data reusables.organizations.click-codespaces %}
1. Under "Billing," select **Disabled**.
{% data reusables.profile.access_org %} {% data reusables.profile.org_settings %} {% data reusables.organizations.click-codespaces %}
1. 在“计费”下,选择“已禁用”。
## Setting a spending limit
## 设置支出限制
{% data reusables.codespaces.codespaces-spending-limit-requirement %}
For information on managing and changing your account's spending limit, see "[Managing your spending limit for {% data variables.product.prodname_codespaces %}](/billing/managing-billing-for-github-codespaces/managing-spending-limits-for-codespaces)."
有关管理和更改帐户支出限制的信息,请参阅“[管理 {% data variables.product.prodname_codespaces %} 的支出限制](/billing/managing-billing-for-github-codespaces/managing-spending-limits-for-codespaces)”。

View File

@@ -1,8 +1,8 @@
---
title: Managing GitHub Codespaces for your organization
title: 为组织启用 GitHub Codespaces
allowTitleToDifferFromFilename: true
shortTitle: Managing your organization
intro: 'You can manage and review how users in your organization can use {% data variables.product.prodname_github_codespaces %}.'
intro: '您可以管理和审查您组织中的用户如何使用 {% data variables.product.prodname_github_codespaces %}'
versions:
fpt: '*'
ghec: '*'
@@ -20,5 +20,11 @@ children:
- /restricting-the-visibility-of-forwarded-ports
- /restricting-the-idle-timeout-period
- /restricting-the-retention-period-for-codespaces
ms.openlocfilehash: 7b8b9211a8bcafdcfb3fb2b037ea6362e8ecb27f
ms.sourcegitcommit: e8c012864f13f9146e53fcb0699e2928c949ffa8
ms.translationtype: HT
ms.contentlocale: zh-CN
ms.lasthandoff: 11/09/2022
ms.locfileid: '148158635'
---

View File

@@ -1,7 +1,7 @@
---
title: Listing the codespaces in your organization
title: 列出组织中的 codespace
shortTitle: List organization codespaces
intro: 'You can list all of the currently active or stopped codespaces for your organization.'
intro: 可以列出组织当前处于活动状态或已停止的所有 codespace。
permissions: 'To list all of the current codespaces for your organization, you must be an organization owner.'
versions:
fpt: '*'
@@ -10,31 +10,36 @@ type: how_to
topics:
- Codespaces
- Administrator
ms.openlocfilehash: e3d475560c76449ed20b70fbce29ef6273f788fc
ms.sourcegitcommit: e8c012864f13f9146e53fcb0699e2928c949ffa8
ms.translationtype: HT
ms.contentlocale: zh-CN
ms.lasthandoff: 11/09/2022
ms.locfileid: '148158627'
---
## 概述
## Overview
作为组织所有者,可以列出组织当前处于活动状态和已停止的所有 codespace。 你可能想要执行此操作来检查用户正在创建多少 codespace以确保不会产生不必要的成本。 有关定价的信息,请参阅“[关于 {% data variables.product.prodname_github_codespaces %} 的计费](/billing/managing-billing-for-github-codespaces/about-billing-for-github-codespaces)”。
As an organization owner, you can list all of the currently active and stopped codespaces for your organization. You might want to do this to check how many codespaces users are creating, to make sure they aren't incurring unnecessary costs. For information about pricing, see "[About billing for {% data variables.product.prodname_github_codespaces %}](/billing/managing-billing-for-github-codespaces/about-billing-for-github-codespaces)."
列出组织的 codespace 的最简单方法是使用 {% data variables.product.prodname_cli %}。 还可以使用 REST API该 API 提供有关每个 codespace 的详细信息。
The easiest way to list the codespaces for an organization is by using {% data variables.product.prodname_cli %}. You can also use the REST API, which provides more information about each codespace.
有关如何查看组织或企业当前总的 {% data variables.product.prodname_codespaces %} 使用情况并生成详细报告的信息,请参阅“[查看 {% data variables.product.prodname_github_codespaces %} 使用情况](/billing/managing-billing-for-github-codespaces/viewing-your-github-codespaces-usage)”。
For information on how to see the current total {% data variables.product.prodname_codespaces %} usage for your organization or enterprise, and generate a detailed report, see "[Viewing your {% data variables.product.prodname_github_codespaces %} usage](/billing/managing-billing-for-github-codespaces/viewing-your-github-codespaces-usage)."
### 使用 {% data variables.product.prodname_cli %} 列出 codespace
### Using {% data variables.product.prodname_cli %} to list codespaces
To list all of the current codespaces for a specified organization, use the following command.
若要列出指定组织的所有当前 codespace,请使用以下命令。
```shell{:copy}
gh codespace list --org ORGANIZATION
```
This command returns a list that includes the following information for each codespace:
- The name and display name
- The user who created the codespace
- The repository and branch
- The current state of the codespace
此命令返回一个列表,其中包含每个 codespace 的以下信息:
- 名称和显示名称
- 创建 codespace 的用户
- 存储库和分支
- codespace 的当前状态
To list all of the current codespaces for an organization that were created by a specific user, use the following command.
若要列出由特定用户创建的组织的所有当前 codespace请使用以下命令。
```shell{:copy}
gh codespace list --org ORGANIZATION --user USER
@@ -42,12 +47,12 @@ gh codespace list --org ORGANIZATION --user USER
{% note %}
**Note**: In the above commands, replace `ORGANIZATION` with the name of the organization you are querying. You must be an owner of the organization.
**注意**:在上述命令中,将 `ORGANIZATION` 替换为要查询的组织的名称。 你必须是组织的所有者。
{% endnote %}
### Using the REST API to list codespaces
### 使用 REST API 列出 codespace
You can use the `/orgs/{org}/codespaces` API endpoint as an alternative method of listing the current codespaces for an organization. This returns more information than {% data variables.product.prodname_cli %}; for example, the machine type details.
可以将 `/orgs/{org}/codespaces` API 终结点用作列出组织当前 codespace 的替代方法。 这将返回比 {% data variables.product.prodname_cli %} 更详细的信息;例如,计算机类型详细信息。
For more information about this endpoint, see "[Codespaces organizations](/rest/codespaces/organizations#list-codespaces-for-the-organization)."
有关此终结点的详细信息,请参阅“[Codespaces 组织](/rest/codespaces/organizations#list-codespaces-for-the-organization)”。

View File

@@ -1,7 +1,7 @@
---
title: Managing repository access for your organization's codespaces
title: 管理组织代码空间的存储库访问
shortTitle: Repository access
intro: 'You can manage the repositories in your organization that {% data variables.product.prodname_github_codespaces %} can access.'
intro: '你可以管理 {% data variables.product.prodname_github_codespaces %} 可以访问的组织中的存储库。'
permissions: 'To manage access and security for {% data variables.product.prodname_github_codespaces %} for an organization, you must be an organization owner.'
versions:
fpt: '*'
@@ -15,26 +15,29 @@ redirect_from:
- /codespaces/managing-codespaces-for-your-organization/managing-access-and-security-for-your-organizations-codespaces
- /github/developing-online-with-codespaces/managing-access-and-security-for-codespaces
- /codespaces/working-with-your-codespace/managing-access-and-security-for-codespaces
ms.openlocfilehash: 9fdec24104a61170977053195446db0b4cf0a62f
ms.sourcegitcommit: e8c012864f13f9146e53fcb0699e2928c949ffa8
ms.translationtype: HT
ms.contentlocale: zh-CN
ms.lasthandoff: 11/09/2022
ms.locfileid: '148159525'
---
{% warning %}
**Deprecation note**: The access and security setting described below is now deprecated and is documented here for reference only. To enable expanded access to other repositories, add the requested permissions to your `devcontainer.json` configuration file. For more information, see "[Managing access to other repositories within your codespace](/codespaces/managing-your-codespaces/managing-repository-access-for-your-codespaces)."
**停用说明**:下方描述的访问和安全设置现已停用,此处记录仅为参考。 若要启用对其他存储库的扩展访问权限,请将请求的权限添加到 `devcontainer.json` 配置文件。 有关详细信息,请参阅“[管理对 codespace 内其他存储库的访问权限](/codespaces/managing-your-codespaces/managing-repository-access-for-your-codespaces)”。
{% endwarning %}
By default, a codespace can only access the repository where it was created. When you enable access and security for a repository owned by your organization, any codespaces that are created for that repository will also have read permissions to all other repositories the organization owns and the codespace creator has permissions to access. If you want to restrict the repositories a codespace can access, you can limit it to either the repository where the codespace was created, or to specific repositories. You should only enable access and security for repositories you trust.
默认情况下,代码空间只能访问创建它的仓库。 当您为组织拥有的存储库启用访问和安全性时,为该存储库创建的任何代码空间也将对组织拥有的所有其他存储库具有读取权限,并且代码空间创建者具有访问权限。 如果要限制代码空间可以访问的存储库,可以将其限制为创建代码空间的存储库或特定存储库。 您应该只对您信任的仓库启用访问和安全。
To manage which users in your organization can use {% data variables.product.prodname_github_codespaces %}, see "[Enabling {% data variables.product.prodname_github_codespaces %} for your organization](/codespaces/managing-codespaces-for-your-organization/enabling-github-codespaces-for-your-organization#enable-codespaces-for-users-in-your-organization)."
要管理组织中的哪些用户可以使用 {% data variables.product.prodname_github_codespaces %},请参阅“[为组织启用 {% data variables.product.prodname_github_codespaces %}](/codespaces/managing-codespaces-for-your-organization/enabling-github-codespaces-for-your-organization#enable-codespaces-for-users-in-your-organization)”。
{% data reusables.profile.access_org %}
{% data reusables.profile.org_settings %}
{% data reusables.organizations.click-codespaces %}
1. Under "Access and security", select the setting you want for your organization.
![Radio buttons to manage trusted repositories](/assets/images/help/settings/codespaces-org-access-and-security-radio-buttons.png)
1. If you chose "Selected repositories", select the dropdown menu, then click a repository to allow the repository's codespaces to access other repositories owned by your organization. Repeat for all repositories whose codespaces you want to access other repositories.
!["Selected repositories" dropdown menu](/assets/images/help/settings/codespaces-access-and-security-repository-drop-down.png)
{% data reusables.profile.access_org %} {% data reusables.profile.org_settings %} {% data reusables.organizations.click-codespaces %}
1. 在“Access and security访问和安全”下为组织选择所需的设置。
![管理受信任存储库的单选按钮](/assets/images/help/settings/codespaces-org-access-and-security-radio-buttons.png)
1. 如果选择了“所选存储库”,请选择下拉菜单,然后单击一个存储库,以允许该存储库的 codespace 访问组织拥有的其他存储库。 对于您要允许其代码空间访问其他仓库的所有仓库重复此操作。
![“所选存储库”下拉菜单](/assets/images/help/settings/codespaces-access-and-security-repository-drop-down.png)
## Further reading
## 延伸阅读
- "[Managing repository access for your codespaces](/codespaces/managing-your-codespaces/managing-repository-access-for-your-codespaces)"
- [管理 codespace 的存储库访问](/codespaces/managing-your-codespaces/managing-repository-access-for-your-codespaces)

View File

@@ -0,0 +1,75 @@
---
title: 管理组织中的 GitHub Codespaces 成本
shortTitle: Manage Codespaces costs
intro: '你可以检查 {% data variables.product.prodname_github_codespaces %} 使用情况并设置使用限制。'
permissions: 'To manage billing for {% data variables.product.prodname_github_codespaces %} for an organization, you must be an organization owner or a billing manager.'
versions:
fpt: '*'
ghec: '*'
type: reference
topics:
- Codespaces
- Billing
redirect_from:
- /codespaces/managing-codespaces-for-your-organization/managing-billing-for-codespaces-in-your-organization
- /codespaces/managing-codespaces-for-your-organization/managing-billing-for-github-codespaces-in-your-organization
ms.openlocfilehash: f11c6e22fa8a233fd4429b91390d25471ad17e6d
ms.sourcegitcommit: e8c012864f13f9146e53fcb0699e2928c949ffa8
ms.translationtype: HT
ms.contentlocale: zh-CN
ms.lasthandoff: 11/09/2022
ms.locfileid: '148158707'
---
## 概述
组织将根据其 {% data variables.product.prodname_github_codespaces %} 的计算和存储使用情况计费。 本文介绍组织所有者管理这些成本的方式。
要了解 {% data variables.product.prodname_github_codespaces %} 定价,请参阅“[关于 {% data variables.product.prodname_github_codespaces %} 的计费](/billing/managing-billing-for-github-codespaces/about-billing-for-github-codespaces#codespaces-pricing)”。
## 支出限制
可以为组织的 {% data variables.product.prodname_github_codespaces %} 设置支出限制。 此限制适用于 {% data variables.product.prodname_github_codespaces %} 的总计算和存储成本。 有关详细信息,请参阅“[管理 {% data variables.product.prodname_github_codespaces %} 的支出限制](/billing/managing-billing-for-github-codespaces/managing-the-spending-limit-for-github-codespaces)”。
- 计算使用情况: 这是所有 {% data variables.product.prodname_github_codespaces %} 实例“codespaces”在计费月份处于活动状态的总时间。
- 存储使用情况:出于 {% data variables.product.prodname_github_codespaces %} 计费目的,这包括你帐户中所有 codespace 和预生成使用的所有文件。 这包括克隆的存储库、配置文件和扩展等资源。
可以检查当前计费月份的 {% data variables.product.prodname_github_codespaces %} 的计算和存储使用情况。 有关信息,请参阅“[查看 {% data variables.product.prodname_github_codespaces %} 使用情况](/billing/managing-billing-for-github-codespaces/viewing-your-github-codespaces-usage)”。
{% note %}
注意:{% data variables.product.prodname_github_codespaces %} 预生成是使用 {% data variables.product.prodname_actions %} 创建和更新的。 这可能会给 {% data variables.product.prodname_actions %} 带来可计费成本。 可以为 {% data variables.product.prodname_actions %} 设置支出限额。 有关详细信息,请参阅“[关于 {% data variables.product.prodname_github_codespaces %} 的计费](/billing/managing-billing-for-github-codespaces/about-billing-for-github-codespaces#billing-for-codespaces-prebuilds)”和“[管理 {% data variables.product.prodname_actions %} 的支出限制](/billing/managing-billing-for-github-actions/managing-your-spending-limit-for-github-actions)”。 生成的预生成存储的费率与 codespace 相同,并包含在 {% data variables.product.prodname_github_codespaces %} 支出限制中。
{% endnote %}
## 禁用或限制 {% data variables.product.prodname_codespaces %}
你可以禁用会对组织进行计费的所有 {% data variables.product.prodname_github_codespaces %} 使用。 或者,你可以指定哪些组织成员或协作者可以使用 {% data variables.product.prodname_codespaces %}(费用由组织承担)。 有关详细信息,请参阅“[为组织启用 {% data variables.product.prodname_github_codespaces %}](/codespaces/managing-codespaces-for-your-organization/enabling-github-codespaces-for-your-organization)”。
{% data reusables.codespaces.codespaces-disabling-org-billing %}
可以配置可从为特定存储库创建的 codespace 访问哪些存储库。 有关详细信息,请参阅“[管理对 codespace 内其他存储库的访问权限](/codespaces/managing-your-codespaces/managing-repository-access-for-your-codespaces)”。
可以限制可用于从组织拥有的存储库创建的 codespace 的计算机类型选择。 这使你可以防止人们使用资源过多的计算机作为其 codespace产生不必要的费用。 有关详细信息,请参阅“[限制对计算机类型的访问](/codespaces/managing-codespaces-for-your-organization/restricting-access-to-machine-types)”。
可以设置最大空闲超时约束,以限制人们为可对你的组织计费的 codespace 设置的最大超时。 通过在较短的超时期后停止活动 codespace可以减少以空闲状态运行的 codespace 生成的计算使用费用。 有关详细信息,请参阅“[限制空闲超时期限](/codespaces/managing-codespaces-for-your-organization/restricting-the-idle-timeout-period)”。
还可以限制停止的 codespace 在自动删除之前可以保持未使用状态的时间长度。 这可帮助降低 {% data variables.product.prodname_codespaces %} 的存储成本。 有关详细信息,请参阅“[限制 codespace 的保持期](/codespaces/managing-codespaces-for-your-organization/restricting-the-retention-period-for-codespaces)”。
为存储库设置预生成的存储库所有者可以通过将预生成配置为仅在选定区域中创建来降低预生成存储成本。 有关详细信息,请参阅“[配置预生成](/codespaces/prebuilding-your-codespaces/configuring-prebuilds#configuring-prebuilds)”。
## 删除未使用的代码空间
你的用户可以在 https://github.com/codespaces 中以及从 {% data variables.product.prodname_vscode %} 中删除他们自己的 codespace。 要减小 codespace 的大小,用户可以使用终端或从 {% data variables.product.prodname_vscode_shortname %} 中手动删除文件。
作为组织所有者,可以删除组织中的任何 codespace。 有关详细信息,请参阅“[删除 codespace](/codespaces/developing-in-codespaces/deleting-a-codespace#deleting-codespaces-in-your-organization)”。
{% note %}
注意Codespace 在停止后会自动删除,并在用户自定义天数内保持非活动状态。 有关详细信息,请参阅“[配置 codespace 的自动删除](/codespaces/customizing-your-codespace/configuring-automatic-deletion-of-your-codespaces)”。 作为组织所有者,你可以为组织拥有的 codespace 设置最大保持期。 这将替代用户的个人保持期设置。 有关详细信息,请参阅“[限制 codespace 的保持期](/codespaces/managing-codespaces-for-your-organization/restricting-the-retention-period-for-codespaces)”。
{% endnote %}
## 延伸阅读
- “[列出组织中的 codespace](/codespaces/managing-codespaces-for-your-organization/listing-the-codespaces-in-your-organization)”

View File

@@ -1,7 +1,7 @@
---
title: Restricting access to machine types
title: 限制对计算机类型的访问
shortTitle: Restrict machine types
intro: You can set constraints on the types of machines users can choose when they create codespaces in your organization.
intro: 你可以对用户在组织中创建 codespace 时可以选择的计算机类型设置约束。
permissions: 'To manage access to machine types for the repositories in an organization, you must be an owner of the organization.'
versions:
fpt: '*'
@@ -9,82 +9,85 @@ versions:
type: how_to
topics:
- Codespaces
ms.openlocfilehash: 202a2cf9f28a55514450415230686c0c0e94600f
ms.sourcegitcommit: e8c012864f13f9146e53fcb0699e2928c949ffa8
ms.translationtype: HT
ms.contentlocale: zh-CN
ms.lasthandoff: 11/09/2022
ms.locfileid: '148159155'
---
## 概述
## Overview
通常,在创建代码空间时,系统会为将运行代码空间的计算机提供一系列规范。 您可以选择最适合您需求的计算机类型。 有关详细信息,请参阅“[为存储库创建 codespace](/codespaces/developing-in-codespaces/creating-a-codespace-for-a-repository#creating-a-codespace-for-a-repository)”。
Typically, when you create a codespace you are offered a choice of specifications for the machine that will run your codespace. You can choose the machine type that best suits your needs. For more information, see "[Creating a codespace for a repository](/codespaces/developing-in-codespaces/creating-a-codespace-for-a-repository#creating-a-codespace-for-a-repository)."
如果您为使用 {% data variables.product.prodname_github_codespaces %} 付费,那么您选择的计算机类型将影响您的账单金额。 codespace 的计算成本与你选择的计算机类型中的处理器核心数成正比。 例如,在 16 核计算机上使用 codespace 一小时的计算成本是 2 核计算机的 8 倍。 有关定价的详细信息,请参阅“[关于 {% data variables.product.prodname_github_codespaces %} 的计费](/billing/managing-billing-for-github-codespaces/about-billing-for-github-codespaces)”。
If you pay for using {% data variables.product.prodname_github_codespaces %} then your choice of machine type will affect how much your are billed. The compute cost for a codespace is proportional to the number of processor cores in the machine type you choose. For example, the compute cost of using a codespace for an hour on a 16-core machine is eight times greater than a 2-core machine. For more information about pricing, see "[About billing for {% data variables.product.prodname_github_codespaces %}](/billing/managing-billing-for-github-codespaces/about-billing-for-github-codespaces)."
作为组织所有者,您可能希望对可用的计算机类型配置约束。 例如,如果组织中的工作不需要大量的计算能力或存储空间,则可以从用户可以选择的选项列表中删除资源丰富的计算机。 为此,可在组织的 {% data variables.product.prodname_github_codespaces %} 设置中定义一个或多个策略。
As an organization owner, you may want to configure constraints on the types of machine that are available. For example, if the work in your organization doesn't require significant compute power or storage space, you can remove the highly resourced machines from the list of options that people can choose from. You do this by defining one or more policies in the {% data variables.product.prodname_github_codespaces %} settings for your organization.
### 设置计算机类型约束时的行为
### Behavior when you set a machine type constraint
如果现有 codespace 不再符合你定义的策略,这些 codespace 将继续运行,直到它们停止或超时。当用户尝试恢复 codespace 时,系统会显示一条消息,告知他们目前选择的计算机类型已不再可供此组织使用,并提示他们选择备用计算机类型。
If there are existing codespaces that no longer conform to a policy you have defined, these codespaces will continue to operate until they are stopped or time out. When the user attempts to resume the codespace they are shown a message telling them that the currenly selected machine type is no longer allowed for this organization and prompting them to choose an alternative machine type.
If you remove higher specification machine types that are required by the {% data variables.product.prodname_github_codespaces %} configuration for an individual repository in your organization, then it won't be possible to create a codespace for that repository. When someone attempts to create a codespace they will see a message telling them that there are no valid machine types available that meet the requirements of the repository's {% data variables.product.prodname_github_codespaces %} configuration.
如果删除组织中单个存储库的 {% data variables.product.prodname_github_codespaces %} 配置所需的更高规范的计算机类型,则无法为该存储库创建 codespace。 当有人尝试创建 codespace 时,他们将看到一条消息,告诉他们没有有效的计算机类型可以满足存储库 {% data variables.product.prodname_github_codespaces %} 配置的要求。
{% note %}
**Note**: Anyone who can edit the `devcontainer.json` configuration file in a repository can set a minimum specification for machines that can be used for codespaces for that repository. For more information, see "[Setting a minimum specification for codespace machines](/codespaces/setting-up-your-project-for-codespaces/setting-a-minimum-specification-for-codespace-machines)."
注意:任何可以在存储库中编辑 `devcontainer.json` 配置文件的人员都可以为计算机设置可用于该存储库的 codespace 的最低规范。 有关详细信息,请参阅“[ codespace 计算机设置最低规范](/codespaces/setting-up-your-project-for-codespaces/setting-a-minimum-specification-for-codespace-machines)”。
{% endnote %}
If setting a policy for machine types prevents people from using {% data variables.product.prodname_github_codespaces %} for a particular repository there are two options:
如果为计算机类型设置策略会阻止用户对特定存储库使用 {% data variables.product.prodname_github_codespaces %},则有两种选择:
* You can adjust your policies to specifically remove the restrictions from the affected repository.
* Anyone who has a codespace that they can no longer access, because of the new policy, can export their codespace to a branch. This branch will contain all of their changes from the codespace. They can then open a new codespace on this branch with a compliant machine type or work on this branch locally. For more information, see "[Exporting changes to a branch](/codespaces/troubleshooting/exporting-changes-to-a-branch)."
* 您可以调整策略以专门从受影响的存储库中删除限制。
* 由于新策略,任何拥有无法再访问的代码空间的人都可以将其代码空间导出到分支。 此分支将包含它们从代码空间所做的所有更改。 然后,他们可以使用兼容的计算机类型在此分支上打开新的代码空间,或者在本地处理此分支。 有关详细信息,请参阅“[将更改导出到分支](/codespaces/troubleshooting/exporting-changes-to-a-branch)”。
### Setting organization-wide and repository-specific policies
### 设置组织范围和存储库特定的策略
When you create a policy you choose whether it applies to all repositories in your organization, or only to specified repositories. If you set an organization-wide policy then any policies you set for individual repositories must fall within the restriction set at the organization level. Adding policies makes the choice of machine more, not less, restrictive.
创建策略时,您可以选择是将其应用于组织中的所有存储库,还是仅应用于指定的存储库。 如果设置了组织范围的策略,则为各个存储库设置的任何策略都必须在组织级别设置的限制范围内。 添加策略会使计算机的选择受到限制更多,而不是更少。
For example, you could create an organization-wide policy that restricts the machine types to either 2 or 4 cores. You can then set a policy for Repository A that restricts it to just 2-core machines. Setting a policy for Repository A that restricted it to machines with 2, 4, or 8 cores would result in a choice of 2-core and 4-core machines only, because the organization-wide policy prevents access to 8-core machines.
例如,您可以创建一个组织范围的策略,将计算机类型限制为 2 核或 4 核。 然后,您可以为存储库 A 设置一个策略,将其限制为仅 2 核计算机。 为存储库 A 设置策略以将其限制为具有 2、4 或 8 核的计算机将导致仅选择 2 核和 4 核计算机,因为组织范围的策略会阻止访问 8 核计算机。
If you add an organization-wide policy, you should set it to the largest choice of machine types that will be available for any repository in your organization. You can then add repository-specific policies to further restrict the choice.
如果添加组织范围的策略,则应将其设置为可用于组织中任何存储库的最大计算机类型选择范围。 然后,您可以添加特定于存储库的策略以进一步限制选择。
{% data reusables.codespaces.codespaces-org-policies-note %}
## Adding a policy to limit the available machine types
## 添加策略以限制可用的计算机类型
{% data reusables.profile.access_org %}
{% data reusables.profile.org_settings %}
{% data reusables.codespaces.codespaces-org-policies %}
1. Click **Add constraint** and choose **Machine types**.
{% data reusables.profile.access_org %} {% data reusables.profile.org_settings %} {% data reusables.codespaces.codespaces-org-policies %}
1. 单击“添加约束”并选择“计算机类型” 。
![Screenshot of the 'Add constraint' dropdown menu](/assets/images/help/codespaces/add-constraint-dropdown.png)
![“添加约束”下拉菜单的屏幕截图](/assets/images/help/codespaces/add-constraint-dropdown.png)
1. Click {% octicon "pencil" aria-label="The edit icon" %} to edit the constraint, then clear the selection of any machine types that you don't want to be available.
1. 单击 {% octicon "pencil" aria-label="The edit icon" %} 以编辑约束,然后清除您不希望可用的任何计算机类型的选择。
![Screenshot of the pencil icon for editing the constraint](/assets/images/help/codespaces/edit-machine-constraint.png)
![用于编辑约束的铅笔图标的屏幕截图](/assets/images/help/codespaces/edit-machine-constraint.png)
{% data reusables.codespaces.codespaces-policy-targets %}
1. If you want to add another constraint to the policy, click **Add constraint** and choose another constraint. For information about other constraints, see:
* "[Restricting the base image for codespaces](/codespaces/managing-codespaces-for-your-organization/restricting-the-base-image-for-codespaces)"
* "[Restricting the visibility of forwarded ports](/codespaces/managing-codespaces-for-your-organization/restricting-the-visibility-of-forwarded-ports)"
* "[Restricting the idle timeout period](/codespaces/managing-codespaces-for-your-organization/restricting-the-idle-timeout-period)"
* "[Restricting the retention period for codespaces](/codespaces/managing-codespaces-for-your-organization/restricting-the-retention-period-for-codespaces)"
1. After you've finished adding constraints to your policy, click **Save**.
1. 如果要向策略添加另一个约束,请单击“添加约束”并选择另一个约束。 有关其他约束的信息,请参阅:
* [限制 codespace 的基础映像](/codespaces/managing-codespaces-for-your-organization/restricting-the-base-image-for-codespaces)
* [限制转发端口的可见性](/codespaces/managing-codespaces-for-your-organization/restricting-the-visibility-of-forwarded-ports)
* [限制空闲超时期限](/codespaces/managing-codespaces-for-your-organization/restricting-the-idle-timeout-period)
* [限制 codespace 的保持期](/codespaces/managing-codespaces-for-your-organization/restricting-the-retention-period-for-codespaces)
1. 向策略添加完约束后,单击“保存”。
The policy will be applied to all new codespaces that are billable to your organization. The machine type constraint is also applied to existing codespaces when someone attempts to restart a stopped codespace or reconnect to an active codespace.
策略将应用于对组织计费的所有新 codespace。 当有人尝试重启已停止的 codespace 或重新连接到活动 codespace 时,计算机类型约束也会应用于现有的 codespace
## Editing a policy
## 编辑策略
You can edit an existing policy. For example, you may want to add or remove constraints to or from a policy.
可以编辑现有策略。 例如,你可能想要在策略中添加或移除约束。
1. Display the "Codespace policies" page. For more information, see "[Adding a policy to limit the available machine types](#adding-a-policy-to-limit-the-available-machine-types)."
1. Click the name of the policy you want to edit.
1. Click the pencil icon ({% octicon "pencil" aria-label="The edit icon" %}) beside the "Machine types" constraint.
1. Make the required changes then click **Save**.
1. 显示“Codespace policies(代码空间策略)”页。 有关详细信息,请参阅“[添加策略以限制可用的计算机类型](#adding-a-policy-to-limit-the-available-machine-types)”。
1. 单击要编辑的策略的名称。
1. 单击“计算机类型”约束旁边的铅笔图标 ({% octicon "pencil" aria-label="The edit icon" %})
1. 执行所需更改,然后单击“保存”。
## Deleting a policy
## 删除策略
1. Display the "Codespace policies" page. For more information, see "[Adding a policy to limit the available machine types](#adding-a-policy-to-limit-the-available-machine-types)."
1. Click the delete button to the right of the policy you want to delete.
1. 显示“Codespace policies(代码空间策略)”页。 有关详细信息,请参阅“[添加策略以限制可用的计算机类型](#adding-a-policy-to-limit-the-available-machine-types)”。
1. 单击要删除的策略右侧的删除按钮。
![Screenshot of the delete button for a policy](/assets/images/help/codespaces/policy-delete.png)
![策略的“删除”按钮的屏幕截图](/assets/images/help/codespaces/policy-delete.png)
## Further reading
## 延伸阅读
- "[Managing spending limits for {% data variables.product.prodname_github_codespaces %}](/billing/managing-billing-for-github-codespaces/managing-the-spending-limit-for-github-codespaces)"
- [管理 {% data variables.product.prodname_github_codespaces %} 的支出限制](/billing/managing-billing-for-github-codespaces/managing-the-spending-limit-for-github-codespaces)

View File

@@ -0,0 +1,103 @@
---
title: 限制 codespace 的基础映像
shortTitle: Restrict base image
intro: 可以指定哪些基础映像可用于在组织内创建的新 codespace。
permissions: 'To manage image constraints for an organization''s codespaces, you must be an owner of the organization.'
versions:
fpt: '*'
ghec: '*'
type: how_to
topics:
- Codespaces
ms.openlocfilehash: 1da438a680dd3e60c1deeec46a98fbcf48f84e5b
ms.sourcegitcommit: e8c012864f13f9146e53fcb0699e2928c949ffa8
ms.translationtype: HT
ms.contentlocale: zh-CN
ms.lasthandoff: 11/09/2022
ms.locfileid: '148158995'
---
## 概述
创建 codespace 时,远程虚拟机上会自动创建 Docker 容器。 Docker 容器是通过 Docker 映像创建的。 映像实际上是 Docker 容器的模板,它确定了 codespace 提供的结果环境的许多方面。
可以在存储库的开发容器配置中指定映像,从而选择要用于 codespace 的映像。 例如,可以使用 `devcontainer.json` 文件中的 `image` 属性来执行此操作。
```json{:copy}
"image": "mcr.microsoft.com/vscode/devcontainers/javascript-node:18",
```
有关详细信息,请参阅 containers.dev 上的[开发容器规范](https://containers.dev/implementors/json_reference/)。
如果未在存储库的开发容器配置中指定映像,则使用默认映像。 默认映像包含许多常用语言和常用工具的运行时版本。 有关详细信息,请参阅“[开发容器简介](/codespaces/setting-up-your-project-for-codespaces/introduction-to-dev-containers#using-the-default-dev-container-configuration)”。
作为组织所有者,你可以添加一个策略来限制哪些映像可用于组织内创建的 codespace。
如果开发容器配置中指定的映像与其中一个允许的映像不匹配,则当有人尝试为存储库创建 codespace 时,会显示以下消息:
> 无法创建 codespace根据组织管理员设置的组织策略不允许使用基础映像“来自开发容器配置的详细信息”。
{% note %}
**注释**
* 基础映像策略仅在创建 codespace 时适用。 目前,在重新生成容器时不适用。 将来的版本中可能会发生变化。 有关详细信息,请参阅“[codespace 生命周期](/codespaces/developing-in-codespaces/the-codespace-lifecycle#rebuilding-a-codespace)”。
* 基本映像策略不适用于默认映像,也不适用于在开发容器配置中引入错误导致无法重新生成容器的情况下用于恢复 codespace 的映像。
{% endnote %}
### 设置组织范围和存储库特定的策略
创建策略时,您可以选择是将其应用于组织中的所有存储库,还是仅应用于指定的存储库。 如果设置了组织范围的策略,则为各个存储库设置的任何策略都必须在组织级别设置的限制范围内。 添加策略会增加映像的限制,而不是减少。
例如,你可以创建一个组织范围的策略,将基础映像限制为十个指定映像中的任意一个。 然后,可以为存储库 A 设置一个策略,将映像限制为仅在组织级别指定的两个映像的子集上。 为存储库 A 指定其他映像将不起作用,因为这些映像未在组织级别策略中指定。 如果添加组织范围的策略,则应将其设置为组织中任何存储库可用的最大映像选择范围。 然后,您可以添加特定于存储库的策略以进一步限制选择。
{% data reusables.codespaces.codespaces-org-policies-note %}
## 添加策略以定义允许的映像
{% data reusables.profile.access_org %} {% data reusables.profile.org_settings %} {% data reusables.codespaces.codespaces-org-policies %}
1. 单击“添加约束”并选择“基础映像” 。
![“添加约束”下拉菜单的屏幕截图](/assets/images/help/codespaces/add-constraint-dropdown-image.png)
1. 单击 {% octicon "pencil" aria-label="The edit icon" %} 编辑约束。
![用于编辑约束的铅笔图标的屏幕截图](/assets/images/help/codespaces/edit-image-constraint.png)
1. 在“允许的值”字段中,输入想要允许的映像的完整 URL。
![“允许的值”字段中条目的屏幕截图](/assets/images/help/codespaces/image-allowed-values.png)
{% note %}
注意:必须指定与开发容器配置中指定的值完全匹配的映像 URL。
{% endnote %}
1. 单击加号按钮 ({% octicon "plus" aria-label="The plus icon" %}) 添加值。
1. 如果需要,请重复前两个步骤以添加更多映像 URL。
{% data reusables.codespaces.codespaces-policy-targets %}
1. 如果要向策略添加另一个约束,请单击“添加约束”并选择另一个约束。 有关其他约束的信息,请参阅:
* “[限制对计算机类型的访问](/codespaces/managing-codespaces-for-your-organization/restricting-access-to-machine-types)”
* [限制转发端口的可见性](/codespaces/managing-codespaces-for-your-organization/restricting-the-visibility-of-forwarded-ports)
* [限制空闲超时期限](/codespaces/managing-codespaces-for-your-organization/restricting-the-idle-timeout-period)
* [限制 codespace 的保持期](/codespaces/managing-codespaces-for-your-organization/restricting-the-retention-period-for-codespaces)
1. 向策略添加完约束后,单击“保存”。
当有人尝试创建可向组织收费的新 codespace 时,将应用该策略。 基本映像约束不会影响现有 codespace无论是活动的还是停止的
## 编辑策略
可以编辑现有策略。 例如,你可能想要在策略中添加或移除约束。
1. 显示“Codespace policies代码空间策略”页。 有关详细信息,请参阅“[添加策略以定义允许的映像](#adding-a-policy-to-define-the-allowed-images)”。
1. 单击要编辑的策略的名称。
1. 单击“基础映像”约束旁边的铅笔图标 ({% octicon "pencil" aria-label="The edit icon" %})。
1. 添加或移除映像 URL。
1. 单击“保存”。
## 删除策略
1. 显示“Codespace policies代码空间策略”页。 有关详细信息,请参阅“[添加策略以定义允许的映像](#adding-a-policy-to-define-the-allowed-images)”。
1. 单击要删除的策略右侧的删除按钮。
![策略的“删除”按钮的屏幕截图](/assets/images/help/codespaces/policy-delete.png)

View File

@@ -1,7 +1,7 @@
---
title: Restricting the idle timeout period
title: 限制空闲超时期限
shortTitle: Restrict timeout periods
intro: You can set a maximum timeout period for any codespaces owned by your organization.
intro: 你可以为组织拥有的任何 codespace 设置最大超时时间。
permissions: 'To manage timeout constraints for an organization''s codespaces, you must be an owner of the organization.'
versions:
fpt: '*'
@@ -9,77 +9,80 @@ versions:
type: how_to
topics:
- Codespaces
ms.openlocfilehash: b07d1834078b065eee89acdb84e0e80a2db1e8a6
ms.sourcegitcommit: e8c012864f13f9146e53fcb0699e2928c949ffa8
ms.translationtype: HT
ms.contentlocale: zh-CN
ms.lasthandoff: 11/09/2022
ms.locfileid: '148158987'
---
## 概述
## Overview
默认情况下codespace 会在处于非活动状态 30 分钟后超时。 当 codespace 超时时,它会停止,并且不会再产生计算使用费用。
By default, codespaces time out after 30 minutes of inactivity. When a codespace times out it is stopped and will no longer incur charges for compute usage.
{% data variables.product.prodname_dotcom %} 用户的个人设置允许他们为创建的 codespace 定义自己的超时期限。 这可能比默认的 30 分钟期限长。 有关详细信息,请参阅“[设置 {% data variables.product.prodname_github_codespaces %} 的超时时间](/codespaces/customizing-your-codespace/setting-your-timeout-period-for-github-codespaces)”。
The personal settings of a {% data variables.product.prodname_dotcom %} user allow them to define their own timeout period for codespaces they create. This may be longer than the default 30-minute period. For more information, see "[Setting your timeout period for {% data variables.product.prodname_github_codespaces %}](/codespaces/customizing-your-codespace/setting-your-timeout-period-for-github-codespaces)."
As an organization owner, you may want to configure constraints on the maximum idle timeout period for codespaces created for repositories owned by your organization. This can help you to limit costs associated with codespaces that are left to timeout after long periods of inactivity. You can set a maximum timeout for the codespaces for all repositories owned by your organization, or for the codespaces of specific repositories.
作为组织所有者,你可能希望为针对组织拥有的存储库创建的 codespace 的最大空闲超时时间配置约束。 这有助于限制与长时间处于非活动状态后超时的 codespace 相关的成本。 你可以为组织拥有的所有存储库的 codespace 或特定存储库的 codespace 设置最大超时。
{% note %}
**Note**: Maximum idle timeout constraints only apply to codespaces that are owned by your organization.
注意:最大空闲超时约束仅应用于组织拥有的 codespace。
{% endnote %}
For more information about pricing for {% data variables.product.prodname_github_codespaces %} compute usage, see "[About billing for {% data variables.product.prodname_github_codespaces %}](/billing/managing-billing-for-github-codespaces/about-billing-for-github-codespaces#codespaces-pricing)."
有关 {% data variables.product.prodname_github_codespaces %} 计算使用量的定价的详细信息,请参阅“[关于 {% data variables.product.prodname_github_codespaces %} 的计费](/billing/managing-billing-for-github-codespaces/about-billing-for-github-codespaces#codespaces-pricing)”。
### Behavior when you set a maximum idle timeout constraint
### 设置最大空闲超时约束时的行为
If someone sets the default idle timeout to 90 minutes in their personal settings and they then start a codespace for a repository with a maximum idle timeout constraint of 60 minutes, the codespace will time out after 60 minutes of inactivity. When codespace creation completes, a message explaining this will be displayed:
如果某人在其个人设置中将默认空闲超时设置为 90 分钟,然后为具有最大空闲超时约束的存储库启动 codespace 60 分钟,则该 codespace 将在处于非活动状态 60 分钟后超时。 codespace 创建完成后,将显示一条消息,指出这一点:
> Idle timeout for this codespace is set to 60 minutes in compliance with your organizations policy.
> 根据组织的策略,此 codespace 的空闲超时设置为 60 分钟。
### Setting organization-wide and repository-specific policies
### 设置组织范围和存储库特定的策略
When you create a policy, you choose whether it applies to all repositories in your organization, or only to specified repositories. If you create an organization-wide policy with a timeout constraint, then the timeout constraints in any policies that are targeted at specific repositories must fall within the restriction configured for the entire organization. The shortest timeout period - in an organization-wide policy, a policy targeted at specified repositories, or in someone's personal settings - is applied.
创建策略时,你可以选择是将其应用于组织中的所有存储库,还是仅应用于指定的存储库。 如果创建具有超时约束的组织范围的策略,则针对特定存储库的任何策略中的超时约束必须属于为整个组织配置的限制。 在组织范围的策略、针对指定存储库的策略或某人的个人设置中的策略中,将应用最短的超时期限。
If you add an organization-wide policy with a timeout constraint, you should set the timeout to the longest acceptable period. You can then add separate policies that set the maximum timeout to a shorter period for specific repositories in your organization.
如果添加具有超时约束的组织范围的策略,则应将超时设置为最长可接受的期限。 然后,可以添加单独的策略,将组织内特定存储库的最大超时设置为较短的期限。
{% data reusables.codespaces.codespaces-org-policies-note %}
## Adding a policy to set a maximum idle timeout period
## 添加策略以设置最大空闲超时期限
{% data reusables.profile.access_org %}
{% data reusables.profile.org_settings %}
{% data reusables.codespaces.codespaces-org-policies %}
1. Click **Add constraint** and choose **Maximum idle timeout**.
{% data reusables.profile.access_org %} {% data reusables.profile.org_settings %} {% data reusables.codespaces.codespaces-org-policies %}
1. 单击“添加约束”,然后选择“最大空闲超时”。
![Screenshot of the 'Add constraint' dropdown menu](/assets/images/help/codespaces/add-constraint-dropdown-timeout.png)
![“添加约束”下拉菜单的屏幕截图](/assets/images/help/codespaces/add-constraint-dropdown-timeout.png)
1. Click {% octicon "pencil" aria-label="The edit icon" %} to edit the constraint.
1. 单击 {% octicon "pencil" aria-label="The edit icon" %} 编辑约束。
![Screenshot of the pencil icon for editing the constraint](/assets/images/help/codespaces/edit-timeout-constraint.png)
![用于编辑约束的铅笔图标的屏幕截图](/assets/images/help/codespaces/edit-timeout-constraint.png)
1. Enter the maximum number of minutes codespaces can remain inactive before they time out, then click **Save**.
1. 输入 codespace 的最大分钟数可以在超时之前保持非活动状态,然后单击“保存”。
![Screenshot of setting the maximum timeout in minutes](/assets/images/help/codespaces/maximum-minutes-timeout.png)
![设置最大超时(以分钟为单位)的屏幕截图](/assets/images/help/codespaces/maximum-minutes-timeout.png)
{% data reusables.codespaces.codespaces-policy-targets %}
1. If you want to add another constraint to the policy, click **Add constraint** and choose another constraint. For information about other constraints, see:
* "[Restricting access to machine types](/codespaces/managing-codespaces-for-your-organization/restricting-access-to-machine-types)"
* "[Restricting the base image for codespaces](/codespaces/managing-codespaces-for-your-organization/restricting-the-base-image-for-codespaces)"
* "[Restricting the visibility of forwarded ports](/codespaces/managing-codespaces-for-your-organization/restricting-the-visibility-of-forwarded-ports)"
* "[Restricting the retention period for codespaces](/codespaces/managing-codespaces-for-your-organization/restricting-the-retention-period-for-codespaces)"
1. After you've finished adding constraints to your policy, click **Save**.
1. 如果要向策略添加另一个约束,请单击“添加约束”并选择另一个约束。 有关其他约束的信息,请参阅:
* [限制对计算机类型的访问](/codespaces/managing-codespaces-for-your-organization/restricting-access-to-machine-types)
* [限制 codespace 的基础映像](/codespaces/managing-codespaces-for-your-organization/restricting-the-base-image-for-codespaces)
* [限制转发端口的可见性](/codespaces/managing-codespaces-for-your-organization/restricting-the-visibility-of-forwarded-ports)
* [限制 codespace 的保持期](/codespaces/managing-codespaces-for-your-organization/restricting-the-retention-period-for-codespaces)
1. 向策略添加完约束后,单击“保存”。
The policy will be applied to all new codespaces that are billable to your organization. The timeout constraint is also applied to existing codespaces the next time they are started.
策略将应用于对组织计费的所有新 codespace。 下次启动现有 codespace 时,超时约束也会对其应用。
## Editing a policy
## 编辑策略
You can edit an existing policy. For example, you may want to add or remove constraints to or from a policy.
可以编辑现有策略。 例如,你可能想要在策略中添加或移除约束。
1. Display the "Codespace policies" page. For more information, see "[Adding a policy to set a maximum idle timeout period](#adding-a-policy-to-set-a-maximum-idle-timeout-period)."
1. Click the name of the policy you want to edit.
1. Click the pencil icon ({% octicon "pencil" aria-label="The edit icon" %}) beside the "Maximum idle timeout" constraint.
1. Make the required changes then click **Save**.
1. 显示“Codespace policies(代码空间策略)”页。 有关详细信息,请参阅“[添加策略以设置最大空闲超时期限](#adding-a-policy-to-set-a-maximum-idle-timeout-period)”。
1. 单击要编辑的策略的名称。
1. 单击“最大空闲超时”约束旁边的铅笔图标 ({% octicon "pencil" aria-label="The edit icon" %})
1. 执行所需更改,然后单击“保存”。
## Deleting a policy
## 删除策略
1. Display the "Codespace policies" page. For more information, see "[Adding a policy to set a maximum idle timeout period](#adding-a-policy-to-set-a-maximum-idle-timeout-period)."
1. Click the delete button to the right of the policy you want to delete.
1. 显示“Codespace policies(代码空间策略)”页。 有关详细信息,请参阅“[添加策略以设置最大空闲超时期限](#adding-a-policy-to-set-a-maximum-idle-timeout-period)”。
1. 单击要删除的策略右侧的删除按钮。
![Screenshot of the delete button for a policy](/assets/images/help/codespaces/policy-delete.png)
![策略的“删除”按钮的屏幕截图](/assets/images/help/codespaces/policy-delete.png)

View File

@@ -1,7 +1,7 @@
---
title: Restricting the retention period for codespaces
title: 限制 codespace 的保持期
shortTitle: Restrict the retention period
intro: You can set a maximum retention period for any codespaces owned by your organization.
intro: 可以为组织拥有的任何 codespace 设置最大保持期。
permissions: 'To manage retention constraints for an organization''s codespaces, you must be an owner of the organization.'
versions:
fpt: '*'
@@ -9,76 +9,79 @@ versions:
type: how_to
topics:
- Codespaces
ms.openlocfilehash: 3c114fe41b06176899f9dd11a6dcd51c038c88e5
ms.sourcegitcommit: e8c012864f13f9146e53fcb0699e2928c949ffa8
ms.translationtype: HT
ms.contentlocale: zh-CN
ms.lasthandoff: 11/09/2022
ms.locfileid: '148158979'
---
## 概述
## Overview
{% data variables.product.prodname_github_codespaces %} 在停止后自动删除,并在定义的天数内保持非活动状态。 创建 codespace 时,将设置每个 codespace 的保持期且不会更改。
{% data variables.product.prodname_github_codespaces %} are automatically deleted after they have been stopped and have remained inactive for a defined number of days. The retention period for each codespace is set when the codespace is created and does not change.
有权访问 {% data variables.product.prodname_github_codespaces %} 的每个人都可以为其创建的 codespace 配置保持期。 此默认保持期的初始设置为 30 天。 个人用户可以在 0-30 天内设置此期限。 有关详细信息,请参阅“[配置 codespace 的自动删除](/codespaces/customizing-your-codespace/configuring-automatic-deletion-of-your-codespaces)”。
Everyone who has access to {% data variables.product.prodname_github_codespaces %} can configure a retention period for the codespaces they create. The initial setting for this default retention period is 30 days. Individual users can set this period within the range 0-30 days. For more information, see "[Configuring automatic deletion of your codespaces](/codespaces/customizing-your-codespace/configuring-automatic-deletion-of-your-codespaces)."
作为组织所有者,你可能希望为针对组织拥有的存储库创建的 codespace 的最大保持期配置约束。 这有助于限制与停止的 codespace 相关联的存储成本,然后在它们自动删除之前保持未使用状态。 有关存储费用的详细信息,请参阅“[关于 {% data variables.product.prodname_github_codespaces %} 的计费](/billing/managing-billing-for-github-codespaces/about-billing-for-github-codespaces#codespaces-pricing)”。 可以为组织拥有的所有或特定存储库设置最大保持期。
As an organization owner, you may want to configure constraints on the maximum retention period for codespaces created for the repositories owned by your organization. This can help you to limit the storage costs associated with codespaces that are stopped and then left unused until they are automatically deleted. For more information about storage charges, see "[About billing for {% data variables.product.prodname_github_codespaces %}](/billing/managing-billing-for-github-codespaces/about-billing-for-github-codespaces#codespaces-pricing)." You can set a maximum retention period for all, or for specific, repositories owned by your organization.
### 设置组织范围和存储库特定的策略
### Setting organization-wide and repository-specific policies
创建策略时,你可以选择是将其应用于组织中的所有存储库,还是仅应用于指定的存储库。 如果使用 codespace 保留约束创建组织范围的策略,则针对特定存储库的任何策略中的保留约束应小于为整个组织配置的限制,否则它们将不起作用。 在组织范围的策略、针对指定存储库的策略或某人个人设置中默认保持期中,将应用最短保持期。
When you create a policy, you choose whether it applies to all repositories in your organization, or only to specified repositories. If you create an organization-wide policy with a codespace retention constraint, then the retention constraints in any policies that are targeted at specific repositories should be shorter than the restriction configured for the entire organization, or they will have no effect. The shortest retention period - in an organization-wide policy, a policy targeted at specified repositories, or the default retention period in someone's personal settings - is applied.
If you add an organization-wide policy with a retention constraint, you should set the retention period to the longest acceptable period. You can then add separate policies that set the maximum retention to a shorter period for specific repositories in your organization.
如果添加具有保留约束的组织范围的策略,则应将保持期设置为最长可接受的期限。 然后,可以添加单独的策略,将组织内特定存储库的最大保持期设置为较短的期限。
{% data reusables.codespaces.codespaces-org-policies-note %}
## Adding a policy to set a maximum codespace retention period
## 添加策略来设置最大 codespace 保持期
{% data reusables.profile.access_org %}
{% data reusables.profile.org_settings %}
{% data reusables.codespaces.codespaces-org-policies %}
1. Click **Add constraint** and choose **Retention period**.
{% data reusables.profile.access_org %} {% data reusables.profile.org_settings %} {% data reusables.codespaces.codespaces-org-policies %}
1. 单击“添加约束”并选择“保持期”。
![Screenshot of the 'Add constraint' dropdown menu](/assets/images/help/codespaces/add-constraint-dropdown-retention.png)
![“添加约束”下拉菜单的屏幕截图](/assets/images/help/codespaces/add-constraint-dropdown-retention.png)
1. Click {% octicon "pencil" aria-label="The edit icon" %} to edit the constraint.
1. 单击 {% octicon "pencil" aria-label="The edit icon" %} 编辑约束。
![Screenshot of the pencil icon for editing the constraint](/assets/images/help/codespaces/edit-timeout-constraint.png)
![用于编辑约束的铅笔图标的屏幕截图](/assets/images/help/codespaces/edit-timeout-constraint.png)
1. Enter the maximum number of days codespaces can remain stopped before they are automatically deleted, then click **Save**.
1. 输入在自动删除 codespace 之前可以保持停止的最大天数,然后单击“保存”。
![Screenshot of setting the retention period in days](/assets/images/help/codespaces/maximum-days-retention.png)
![设置屏幕截图(以天为单位)的屏幕截图](/assets/images/help/codespaces/maximum-days-retention.png)
{% note %}
**Notes**:
* A day, in this context, is a 24-hour period, beginning at the time of day when the codespace was stopped.
* The valid range is 0-30 days.
* Setting the period to `0` will result in codespaces being immediately deleted when they are stopped, or when they timeout due to inactivity.
**注释**
* 在此上下文中,一天指的是 24 小时时段,从 codespace 当天停止的时间开始。
* 有效范围是 0 到 30 天。
* 将期限设置为 `0` 将导致 codespace 在停止时或由于不活动而超时时被立即删除。
{% endnote %}
{% data reusables.codespaces.codespaces-policy-targets %}
1. If you want to add another constraint to the policy, click **Add constraint** and choose another constraint. For information about other constraints, see:
* "[Restricting access to machine types](/codespaces/managing-codespaces-for-your-organization/restricting-access-to-machine-types)"
* "[Restricting the base image for codespaces](/codespaces/managing-codespaces-for-your-organization/restricting-the-base-image-for-codespaces)"
* "[Restricting the visibility of forwarded ports](/codespaces/managing-codespaces-for-your-organization/restricting-the-visibility-of-forwarded-ports)"
* "[Restricting the idle timeout period](/codespaces/managing-codespaces-for-your-organization/restricting-the-idle-timeout-period)"
1. After you've finished adding constraints to your policy, click **Save**.
1. 如果要向策略添加另一个约束,请单击“添加约束”并选择另一个约束。 有关其他约束的信息,请参阅:
* [限制对计算机类型的访问](/codespaces/managing-codespaces-for-your-organization/restricting-access-to-machine-types)
* [限制 codespace 的基础映像](/codespaces/managing-codespaces-for-your-organization/restricting-the-base-image-for-codespaces)
* [限制转发端口的可见性](/codespaces/managing-codespaces-for-your-organization/restricting-the-visibility-of-forwarded-ports)
* [限制空闲超时期限](/codespaces/managing-codespaces-for-your-organization/restricting-the-idle-timeout-period)
1. 向策略添加完约束后,单击“保存”。
The policy will be applied to all new codespaces that are billable to your organization. The retention period constraint is only applied on codespace creation.
策略将应用于对组织计费的所有新 codespace。 保持期约束仅在创建 codespace 时应用。
## Editing a policy
## 编辑策略
You can edit an existing policy. For example, you may want to add or remove constraints to or from a policy.
可以编辑现有策略。 例如,你可能想要在策略中添加或移除约束。
The retention period constraint is only applied to codespaces when they are created. Editing a policy has no effect on existing codespaces.
保持期约束仅在创建 codespace 时应用于它们。 编辑策略不会影响现有 codespace
1. Display the "Codespace policies" page. For more information, see "[Adding a policy to set a maximum codespace retention period](#adding-a-policy-to-set-a-maximum-codespace-retention-period)."
1. Click the name of the policy you want to edit.
1. Click the pencil icon ({% octicon "pencil" aria-label="The edit icon" %}) beside the "Retention period" constraint.
1. Make the required changes then click **Save**.
1. 显示“Codespace policies(代码空间策略)”页。 有关详细信息,请参阅“[添加策略以设置最大 codespace 保持期](#adding-a-policy-to-set-a-maximum-codespace-retention-period)”。
1. 单击要编辑的策略的名称。
1. 单击“保持期”约束旁边的铅笔图标 ({% octicon "pencil" aria-label="The edit icon" %})
1. 执行所需更改,然后单击“保存”。
## Deleting a policy
## 删除策略
You can delete a policy at any time. Deleting a policy has no effect on existing codespaces.
可以随时删除策略。 删除策略不会影响现有 codespace
1. Display the "Codespace policies" page. For more information, see "[Adding a policy to set a maximum codespace retention period](#adding-a-policy-to-set-a-maximum-codespace-retention-period)."
1. Click the delete button to the right of the policy you want to delete.
1. 显示“Codespace policies(代码空间策略)”页。 有关详细信息,请参阅“[添加策略以设置最大 codespace 保持期](#adding-a-policy-to-set-a-maximum-codespace-retention-period)”。
1. 单击要删除的策略右侧的删除按钮。
![Screenshot of the delete button for a policy](/assets/images/help/codespaces/policy-delete.png)
![策略的“删除”按钮的屏幕截图](/assets/images/help/codespaces/policy-delete.png)

View File

@@ -1,7 +1,7 @@
---
title: Restricting the visibility of forwarded ports
title: 限制转发端口的可见性
shortTitle: Restrict port visibility
intro: You can set constraints on the visibility options users can choose when they forward ports from codespaces in your organization.
intro: 你可以针对用户从组织中的 codespace 转发端口时选择的可见性选项设置约束。
permissions: 'To manage access to port visibility constraints for the repositories in an organization, you must be an owner of the organization.'
versions:
fpt: '*'
@@ -9,73 +9,76 @@ versions:
type: how_to
topics:
- Codespaces
ms.openlocfilehash: ad670b43e0ac2a80e43048ffa61e0c83a8d12130
ms.sourcegitcommit: e8c012864f13f9146e53fcb0699e2928c949ffa8
ms.translationtype: HT
ms.contentlocale: zh-CN
ms.lasthandoff: 11/09/2022
ms.locfileid: '148158971'
---
## 概述
## Overview
通常,在 codespace 中,可以私密地(仅向你自己)、向组织成员或公开(向任何具有 URL 的人)转发端口。 有关详细信息,请参阅“[在 codespace 中转发端口](/codespaces/developing-in-codespaces/forwarding-ports-in-your-codespace)”。
Typically, within a codespace you are able to forward ports privately (only to yourself), to members of your organization, or publicly (to anyone with the URL). For more information, see "[Forwarding ports in your codespace](/codespaces/developing-in-codespaces/forwarding-ports-in-your-codespace)."
作为组织所有者,你可能希望对用户在转发端口时可以设置的可见性选项配置约束。 例如,出于安全原因,你可能希望禁止公共端口转发。 为此,你可以在组织的 {% data variables.product.prodname_github_codespaces %} 设置中定义一个或多个策略。
As an organization owner, you may want to configure constraints on the visibility options users can set when forwarding ports. For example, for security reasons, you may want to disallow public port forwarding. You do this by defining one or more policies in the {% data variables.product.prodname_github_codespaces %} settings for your organization.
### 设置端口可见性约束时的行为
### Behavior when you set a port visibility constraint
If there are existing codespaces that no longer conform to a policy you have defined, these codespaces will continue to operate until they are stopped or time out. When the user resumes the codespace, it will be subject to the policy constraints.
如果存在不再符合你定义的策略的现有 codespaces这些 codespaces 将继续运行,直到它们停止或超时。当用户继续使用 codespace 时,将受策略约束。
{% note %}
**Note**: You can't disable private port forwarding, as private port forwarding is required by {% data variables.product.prodname_github_codespaces %} to continue working as designed, for example to forward SSH on port 22.
注意:无法禁用专用端口转发,因为 {% data variables.product.prodname_github_codespaces %} 需要专用端口转发才能继续按照设计的方式工作,例如在端口 22 上转发 SSH。
{% endnote %}
### Setting organization-wide and repository-specific policies
### 设置组织范围和存储库特定的策略
When you create a policy you choose whether it applies to all repositories in your organization, or only to specified repositories. If you set an organization-wide policy then any policies you set for individual repositories must fall within the restriction set at the organization level. Adding policies makes the choice of visibility options more, not less, restrictive.
创建策略时,您可以选择是将其应用于组织中的所有存储库,还是仅应用于指定的存储库。 如果设置了组织范围的策略,则为各个存储库设置的任何策略都必须在组织级别设置的限制范围内。 添加策略会增加可见性选项的限制,而不是减少。
For example, you could create an organization-wide policy that restricts the visibility options to organization only. You can then set a policy for Repository A that disallows both public and organization visibility, which would result in only private port forwarding being available for this repository. Setting a policy for Repository A that allowed both public and organization would result in only organization visibility, because the organization-wide policy does not allow public visibility.
例如,你可以创建一个组织范围的策略,将可见性选项限制在组织范围内。 然后,可以为存储库 A 设置一个策略,该策略不允许公共和组织可见性,这将导致此存储库只能使用专用端口转发。 如果为存储库 A 设置一个既允许公开又允许组织的策略,将只有组织可见,因为组织范围的策略不允许公开可见性。
If you add an organization-wide policy, you should set it to the most lenient visibility option that will be available for any repository in your organization. You can then add repository-specific policies to further restrict the choice.
如果添加组织范围的策略,则应将其设置为组织中任何存储库可用的最宽松的可见性选项。 然后,您可以添加特定于存储库的策略以进一步限制选择。
{% data reusables.codespaces.codespaces-org-policies-note %}
## Adding a policy to limit the port visibility options
## 添加限制端口可见性选项的策略
{% data reusables.profile.access_org %}
{% data reusables.profile.org_settings %}
{% data reusables.codespaces.codespaces-org-policies %}
1. Click **Add constraint** and choose **Port visibility**.
{% data reusables.profile.access_org %} {% data reusables.profile.org_settings %} {% data reusables.codespaces.codespaces-org-policies %}
1. 单击“添加约束”并选择“端口可见性” 。
![Screenshot of the 'Add constraint' dropdown menu](/assets/images/help/codespaces/add-constraint-dropdown-ports.png)
![“添加约束”下拉菜单的屏幕截图](/assets/images/help/codespaces/add-constraint-dropdown-ports.png)
1. Click {% octicon "pencil" aria-label="The edit icon" %} to edit the constraint.
1. 单击 {% octicon "pencil" aria-label="The edit icon" %} 编辑约束。
![Screenshot of the pencil icon for editing the constraint](/assets/images/help/codespaces/edit-port-visibility-constraint.png)
![用于编辑约束的铅笔图标的屏幕截图](/assets/images/help/codespaces/edit-port-visibility-constraint.png)
1. Clear the selection of the port visibility options (**Org** or **Public**) that you don't want to be available.
1. 清除不希望提供的端口可见性选项(组织或公共) 。
![Screenshot of clearing a port visibility option](/assets/images/help/codespaces/choose-port-visibility-options.png)
![清除端口可见性选项的屏幕截图](/assets/images/help/codespaces/choose-port-visibility-options.png)
{% data reusables.codespaces.codespaces-policy-targets %}
1. If you want to add another constraint to the policy, click **Add constraint** and choose another constraint. For information about other constraints, see:
* "[Restricting access to machine types](/codespaces/managing-codespaces-for-your-organization/restricting-access-to-machine-types)"
* "[Restricting the base image for codespaces](/codespaces/managing-codespaces-for-your-organization/restricting-the-base-image-for-codespaces)"
* "[Restricting the idle timeout period](/codespaces/managing-codespaces-for-your-organization/restricting-the-idle-timeout-period)"
* "[Restricting the retention period for codespaces](/codespaces/managing-codespaces-for-your-organization/restricting-the-retention-period-for-codespaces)"
1. After you've finished adding constraints to your policy, click **Save**.
1. 如果要向策略添加另一个约束,请单击“添加约束”并选择另一个约束。 有关其他约束的信息,请参阅:
* [限制对计算机类型的访问](/codespaces/managing-codespaces-for-your-organization/restricting-access-to-machine-types)
* [限制 codespace 的基础映像](/codespaces/managing-codespaces-for-your-organization/restricting-the-base-image-for-codespaces)
* [限制空闲超时期限](/codespaces/managing-codespaces-for-your-organization/restricting-the-idle-timeout-period)
* [限制 codespace 的保持期](/codespaces/managing-codespaces-for-your-organization/restricting-the-retention-period-for-codespaces)
1. 向策略添加完约束后,单击“保存”。
The policy will be applied to all new codespaces that are billable to your organization. The port visibility constraint is also applied to existing codespaces the next time they are started.
策略将应用于对组织计费的所有新 codespace。 下次启动现有 codespace 时,端口可见性约束也会对其应用。
## Editing a policy
## 编辑策略
You can edit an existing policy. For example, you may want to add or remove constraints to or from a policy.
可以编辑现有策略。 例如,你可能想要在策略中添加或移除约束。
1. Display the "Codespace policies" page. For more information, see "[Adding a policy to limit the port visibility options](#adding-a-policy-to-limit-the-port-visibility-options)."
1. Click the name of the policy you want to edit.
1. Click the pencil icon ({% octicon "pencil" aria-label="The edit icon" %}) beside the "Port visibility" constraint.
1. Make the required changes then click **Save**.
1. 显示“Codespace policies(代码空间策略)”页。 有关详细信息,请参阅“[添加策略以限制端口可见性选项](#adding-a-policy-to-limit-the-port-visibility-options)”。
1. 单击要编辑的策略的名称。
1. 单击“端口可见性”约束旁边的铅笔图标 ({% octicon "pencil" aria-label="The edit icon" %})
1. 执行所需更改,然后单击“保存”。
## Deleting a policy
## 删除策略
1. Display the "Codespace policies" page. For more information, see "[Adding a policy to limit the port visibility options](#adding-a-policy-to-limit-the-port-visibility-options)."
1. Click the delete button to the right of the policy you want to delete.
1. 显示“Codespace policies(代码空间策略)”页。 有关详细信息,请参阅“[添加策略以限制端口可见性选项](#adding-a-policy-to-limit-the-port-visibility-options)”。
1. 单击要删除的策略右侧的删除按钮。
![Screenshot of the delete button for a policy](/assets/images/help/codespaces/policy-delete.png)
![策略的“删除”按钮的屏幕截图](/assets/images/help/codespaces/policy-delete.png)

View File

@@ -1,7 +1,7 @@
---
title: Reviewing your organization's audit logs for GitHub Codespaces
title: 查看组织的 GitHub Codespaces 审核日志
shortTitle: Audit logs
intro: 'You can use the audit log to review all actions related to {% data variables.product.prodname_github_codespaces %}.'
intro: '你可以使用审核日志查看与 {% data variables.product.prodname_github_codespaces %} 相关的所有操作。'
versions:
fpt: '*'
ghec: '*'
@@ -12,17 +12,20 @@ topics:
- Administrator
redirect_from:
- /codespaces/managing-codespaces-for-your-organization/reviewing-your-organizations-audit-logs-for-codespaces
ms.openlocfilehash: 81fbf92217c704ece2f1076de03e1f0445ded2c5
ms.sourcegitcommit: e8c012864f13f9146e53fcb0699e2928c949ffa8
ms.translationtype: HT
ms.contentlocale: zh-CN
ms.lasthandoff: 11/09/2022
ms.locfileid: '148159503'
---
当组织的任何成员执行与 {% data variables.product.prodname_github_codespaces %} 相关的操作时,你可以在审核日志中查看这些操作。 有关访问日志的信息,请参阅“[查看审核日志](/organizations/keeping-your-organization-secure/reviewing-the-audit-log-for-your-organization#accessing-the-audit-log)”。
![包含代码空间信息的审核日志](/assets/images/help/settings/codespaces-audit-log-org.png)
When any member of your organization performs an action related to {% data variables.product.prodname_github_codespaces %}, you can review the actions in the audit log. For information about accessing the log, see "[Reviewing your audit log](/organizations/keeping-your-organization-secure/reviewing-the-audit-log-for-your-organization#accessing-the-audit-log)."
审核日志包含操作执行人、操作内容和执行时间等详细信息。 有关 {% data variables.product.prodname_github_codespaces %} 操作的信息,请参阅“[`codespaces` 类别操作](/organizations/keeping-your-organization-secure/reviewing-the-audit-log-for-your-organization#codespaces-category-actions)”。
![Audit log with Codespaces information](/assets/images/help/settings/codespaces-audit-log-org.png)
## 延伸阅读
The audit log includes details such as who performed the action, what the action was, and when the action was performed. For information on {% data variables.product.prodname_github_codespaces %} actions, see "[`codespaces` category actions](/organizations/keeping-your-organization-secure/reviewing-the-audit-log-for-your-organization#codespaces-category-actions)."
## Further reading
- "[Reviewing your security logs for {% data variables.product.prodname_github_codespaces %}](/codespaces/managing-your-codespaces/reviewing-your-security-logs-for-github-codespaces)"
- "[{% data variables.product.prodname_github_codespaces %} logs](/codespaces/troubleshooting/github-codespaces-logs)"
- “[查看 {% data variables.product.prodname_github_codespaces %} 的安全日志](/codespaces/managing-your-codespaces/reviewing-your-security-logs-for-github-codespaces)”
- [{% data variables.product.prodname_github_codespaces %} 日志](/codespaces/troubleshooting/github-codespaces-logs)

View File

@@ -1,6 +1,6 @@
---
title: Managing encrypted secrets for your codespaces
intro: 'You can store sensitive information, like tokens, that you want to access in your codespaces via environment variables.'
title: 管理代码空间的加密密码
intro: 您可以在代码空间中存储要通过环境变量访问的敏感信息(如令牌)。
versions:
fpt: '*'
ghec: '*'
@@ -14,89 +14,84 @@ topics:
- Security
- Secret store
shortTitle: Encrypted secrets
ms.openlocfilehash: f2ef60c9311a81ea59ec4f71cb7c1a432102b063
ms.sourcegitcommit: e8c012864f13f9146e53fcb0699e2928c949ffa8
ms.translationtype: HT
ms.contentlocale: zh-CN
ms.lasthandoff: 11/09/2022
ms.locfileid: '148160440'
---
## 关于 {% data variables.product.prodname_github_codespaces %} 的加密机密
你可以将要在 codespace 中使用的加密密码添加到你的个人帐户。 例如,您可能想要存储和访问以下敏感信息作为加密密码。
- 云服务的访问令牌
- 服务主体
- 订阅标识符
- [专用映像注册表的凭据](/codespaces/codespaces-reference/allowing-your-codespace-to-access-a-private-image-registry)
## About encrypted secrets for {% data variables.product.prodname_github_codespaces %}
You can add encrypted secrets to your personal account that you want to use in your codespaces. For example, you may want to store and access the following sensitive information as encrypted secrets.
- Access tokens to cloud services
- Service principals
- Subscription identifiers
- [Credentials for a private image registry](/codespaces/codespaces-reference/allowing-your-codespace-to-access-a-private-image-registry)
You can choose which repositories should have access to each secret. Then, you can use the secret in any codespace you create for a repository that has access to the secret. To share a secret with a codespace created from a template, you will need to publish the codespace to a repository on {% data variables.product.prodname_dotcom %}, then give that repository access to the secret.
您可以选择哪些仓库应有权访问每个密码。 然后,您可以在为有权访问密码的仓库创建的任何代码空间中使用该密码。 若要与通过模板创建的 codespace 共享机密,需要将 codespace 发布到 {% data variables.product.prodname_dotcom %} 上的存储库,然后授予该存储库对该机密的访问权限。
{% data reusables.codespaces.secrets-on-start %}
### Naming secrets
### 命名密钥
{% data reusables.codespaces.secrets-naming %} For example, a secret created at the repository level must have a unique name in that repository.
{% data reusables.codespaces.secrets-naming %} 例如,在仓库级别创建的密钥必须在该仓库中具有唯一的名称。
{% data reusables.codespaces.secret-precedence %}
### Limits for secrets
### 密码的限制
You can store up to 100 secrets for {% data variables.product.prodname_github_codespaces %}.
最多可以为 {% data variables.product.prodname_github_codespaces %} 存储 100 个密码。
Secrets are limited to 64 KB in size.
密码大小限于 64 KB。
## Adding a secret
## 添加密码
{% data reusables.user-settings.access_settings %}
{% data reusables.user-settings.codespaces-tab %}
1. To the right of "Codespaces secrets", click **New secret**.
!["New secret" button](/assets/images/help/settings/codespaces-new-secret-button.png)
1. Under "Name", type a name for your secret.
!["Name" text box](/assets/images/help/settings/codespaces-secret-name-field.png)
{% data reusables.user-settings.codespaces-secret-value %}
{% data reusables.user-settings.codespaces-secret-repository-access %}
1. Click **Add secret**.
{% data reusables.user-settings.access_settings %} {% data reusables.user-settings.codespaces-tab %}
1. 在“Codespaces 机密”右侧,单击“新建机密”。
![“新建机密”按钮](/assets/images/help/settings/codespaces-new-secret-button.png)
1. 在“Name名称”下输入密码的名称。
![“名称”文本框](/assets/images/help/settings/codespaces-secret-name-field.png) {% data reusables.user-settings.codespaces-secret-value %} {% data reusables.user-settings.codespaces-secret-repository-access %}
1. 单击“添加机密”。
## Editing a secret
## 编辑密码
You can update the value of an existing secret, and you can change which repositories can access a secret.
您可以更新现有密码的值,也可以更改哪些仓库可以访问密码。
{% data reusables.user-settings.access_settings %}
{% data reusables.user-settings.codespaces-tab %}
1. Under "Codespaces secrets", to the right of the secret you want to edit, click **Update**.
!["Update" button](/assets/images/help/settings/codespaces-secret-update-button.png)
1. Under "Value", click **enter a new value**.
!["enter a new value" link](/assets/images/help/settings/codespaces-secret-update-value-text.png)
{% data reusables.user-settings.codespaces-secret-value %}
{% data reusables.user-settings.codespaces-secret-repository-access %}
1. Optionally, to remove the secret's access to a repository, deselect the repository.
![Checkboxes to remove access to repositories](/assets/images/help/settings/codespaces-secret-repository-checkboxes.png)
1. Click **Save changes**.
{% data reusables.user-settings.access_settings %} {% data reusables.user-settings.codespaces-tab %}
1. 在“Codespaces 机密”下,在要编辑的机密的右侧,单击“更新”。
![“更新”按钮](/assets/images/help/settings/codespaces-secret-update-button.png)
1. 在“值”下,单击“输入新值”。
![“输入新值”链接](/assets/images/help/settings/codespaces-secret-update-value-text.png) {% data reusables.user-settings.codespaces-secret-value %} {% data reusables.user-settings.codespaces-secret-repository-access %}
1. (可选)要删除密码对仓库的访问权限,请取消选择仓库。
![用于删除对存储库的访问权限的复选框](/assets/images/help/settings/codespaces-secret-repository-checkboxes.png)
1. 单击“保存更改”。
## Deleting a secret
## 删除密码
{% data reusables.user-settings.access_settings %}
{% data reusables.user-settings.codespaces-tab %}
1. Under "Codespaces secrets", to the right of the secret you want to delete, click **Delete**.
!["Delete" button](/assets/images/help/settings/codespaces-secret-delete-button.png)
1. Read the warning, then click **OK**.
![Confirmation to delete secret](/assets/images/help/settings/codespaces-secret-delete-warning.png)
{% data reusables.user-settings.access_settings %} {% data reusables.user-settings.codespaces-tab %}
1. 在“Codespaces 机密”下,在要删除的机密的右侧,单击“删除”。
![“删除”按钮](/assets/images/help/settings/codespaces-secret-delete-button.png)
1. 阅读警告,然后单击“确定”。
![确认删除机密](/assets/images/help/settings/codespaces-secret-delete-warning.png)
## Using secrets
## 使用机密
A secret is exported as an environment variable into the user's terminal session.
机密作为环境变量导出到用户的终端会话中。
![Displaying the value of an exported secret in the terminal](/assets/images/help/codespaces/exported-codespace-secret.png)
![在终端显示导出机密的值](/assets/images/help/codespaces/exported-codespace-secret.png)
You can use secrets in a codespace after the codespace is built and is running. For example, a secret can be used:
Codespace 生成并运行后,可以在 Codespace 中使用机密。 例如,机密可用于:
* When launching an application from the integrated terminal or ssh session.
* Within a dev container lifecycle script that is run after the codespace is running. For more information about dev container lifecycle scripts, see the documentation on containers.dev: [Specification](https://containers.dev/implementors/json_reference/#lifecycle-scripts).
* 从集成终端或 ssh 会话启动应用程序时。
* 在 Codespace 开始运行后运行的开发容器生命周期脚本中。 有关开发容器生命周期脚本的详细信息,请参阅 containers.dev 的相关文档:[规范](https://containers.dev/implementors/json_reference/#lifecycle-scripts)
Codespace secrets cannot be used:
codespace 机密不可用于以下情况:
* During codespace build time (that is, within a Dockerfile or custom entry point).
* Within a dev container feature. For more information, see the `features` property in the [dev containers specification](https://containers.dev/implementors/json_reference/#general-properties) on containers.dev.
* codespace 生成时(即,在 Dockerfile 或自定义入口点内)。
* 在开发容器功能内。 有关详细信息,请参阅 containers.dev 上的[开发容器规范](https://containers.dev/implementors/json_reference/#general-properties)中的 `features` 属性。
## Further reading
## 延伸阅读
- "[Managing encrypted secrets for your repository and organization for {% data variables.product.prodname_github_codespaces %}](/codespaces/managing-codespaces-for-your-organization/managing-encrypted-secrets-for-your-repository-and-organization-for-github-codespaces)"
- [管理 {% data variables.product.prodname_github_codespaces %} 的存储库和组织的加密密码](/codespaces/managing-codespaces-for-your-organization/managing-encrypted-secrets-for-your-repository-and-organization-for-github-codespaces)

View File

@@ -1,6 +1,6 @@
---
title: Managing GPG verification for GitHub Codespaces
intro: 'You can allow {% data variables.product.company_short %} to automatically use GPG to sign commits you make in your codespaces, so other people can be confident that the changes come from a trusted source.'
title: 管理 GitHub Codespaces 的 GPG 验证
intro: '您可以允许 {% data variables.product.company_short %} 自动使用 GPG 对在代码空间中所做的提交进行签名,以便其他人可以确信更改来自受信任的源。'
versions:
fpt: '*'
ghec: '*'
@@ -14,26 +14,28 @@ redirect_from:
- /codespaces/working-with-your-codespace/managing-gpg-verification-for-codespaces
- /codespaces/managing-your-codespaces/managing-gpg-verification-for-codespaces
shortTitle: GPG verification
ms.openlocfilehash: ff83eba1720a2841747536ec04bfc0b3db055669
ms.sourcegitcommit: 47e03737d09bed84dfedb7be5924d893d34ea1a8
ms.translationtype: HT
ms.contentlocale: zh-CN
ms.lasthandoff: 11/16/2022
ms.locfileid: '148167099'
---
After you enable GPG verification, {% data variables.product.company_short %} will automatically sign commits you make in {% data variables.product.prodname_github_codespaces %}, and the commits will have a verified status on {% data variables.product.product_name %}. By default, GPG verification is disabled for codespaces you create. You can choose to allow GPG verification for all repositories or specific repositories. Only enable GPG verification for repositories that you trust. For more information about {% data variables.product.product_name %}-signed commits, see "[About commit signature verification](/github/authenticating-to-github/about-commit-signature-verification)."
启用 GPG 验证后,{% data variables.product.company_short %} 将自动对你在 {% data variables.product.prodname_github_codespaces %} 中所做的提交进行签名,并且该提交在 {% data variables.product.product_name %} 上具有已验证状态。 默认情况下GPG 验证对您创建的代码空间禁用。 您可以选择对所有仓库或特定仓库允许 GPG 验证。 仅对您信任的仓库启用 GPG 验证。 有关 {% data variables.product.product_name %} 签名提交的更多信息,请参阅[关于提交签名验证](/github/authenticating-to-github/about-commit-signature-verification)。
{% data reusables.codespaces.gpg-in-active-codespaces %}
{% note %}
**Note:** If you have linked a dotfiles repository with {% data variables.product.prodname_github_codespaces %}, the Git configuration in your dotfiles may conflict with the configuration that {% data variables.product.prodname_github_codespaces %} requires to sign commits. For more information, see "[Troubleshooting GPG verification for {% data variables.product.prodname_github_codespaces %}](/codespaces/troubleshooting/troubleshooting-gpg-verification-for-github-codespaces)."
注意:如果已将点文件存储库链接到 {% data variables.product.prodname_github_codespaces %},则点文件中的 Git 配置可能与 {% data variables.product.prodname_github_codespaces %} 签署提交所需的配置冲突。 有关详细信息,请参阅“[{% data variables.product.prodname_github_codespaces %} 的 GPG 验证疑难解答](/codespaces/troubleshooting/troubleshooting-gpg-verification-for-github-codespaces)”。
{% endnote %}
{% data reusables.user-settings.access_settings %}
{% data reusables.user-settings.codespaces-tab %}
1. Under "GPG verification", select the setting you want for GPG verification.
![Radio buttons to manage GPG verification](/assets/images/help/settings/codespaces-gpg-verification-radio-buttons.png)
1. If you chose "Selected repositories", select the dropdown menu, then click a repository you want enable GPG verification for. Repeat for all repositories you want to enable GPG verification for.
!["Selected repositories" dropdown menu](/assets/images/help/settings/codespaces-gpg-verification-repository-drop-down.png)
{% data reusables.user-settings.access_settings %} {% data reusables.user-settings.codespaces-tab %}
1. 在“GPG verificationGPG 验证)”下,选择您想要的 GPG 验证设置。
![管理 GPG 验证的单选按钮](/assets/images/help/settings/codespaces-gpg-verification-radio-buttons.png)
1. 如果选择“所选存储库”,请选择下拉菜单,然后单击要为其启用 GPG 验证的存储库。 对您要启用 GPG 验证的所有仓库重复此操作。
![“所选存储库”下拉菜单](/assets/images/help/settings/codespaces-gpg-verification-repository-drop-down.png)
Once you have enabled GPG verification for {% data variables.product.prodname_github_codespaces %}, all commits are signed by default in your codespaces.
{% data variables.product.prodname_github_codespaces %} 启用 GPG 验证后,默认情况下所有提交都会在 codespace 中进行签名。

View File

@@ -1,8 +1,8 @@
---
title: Managing access to other repositories within your codespace
title: 管理对代码空间中其他存储库的访问权限
allowTitleToDifferFromFilename: true
shortTitle: Repository access
intro: 'You can manage the repositories that {% data variables.product.prodname_github_codespaces %} can access.'
intro: '你可以管理 {% data variables.product.prodname_github_codespaces %} 可以访问的存储库。'
versions:
fpt: '*'
ghec: '*'
@@ -11,26 +11,31 @@ topics:
- Security
redirect_from:
- /codespaces/managing-your-codespaces/managing-access-and-security-for-your-codespaces
ms.openlocfilehash: 3f8379c322bd7ccd9ff7d31e17da90a77461536d
ms.sourcegitcommit: e8c012864f13f9146e53fcb0699e2928c949ffa8
ms.translationtype: HT
ms.contentlocale: zh-CN
ms.lasthandoff: 11/09/2022
ms.locfileid: '148159487'
---
## 概述
## Overview
默认情况下,代码空间分配有一个令牌,该令牌的范围限定为从中创建它的存储库。 将通过模板创建的 codespace 发布到 {% data variables.product.product_name %} 上的新存储库时,系统会为 codespace 分配一个作用域为新存储库的令牌。 有关详细信息,请参阅“[{% data variables.product.prodname_github_codespaces %} 中的安全性](/codespaces/codespaces-reference/security-in-github-codespaces#authentication)”。 如果项目需要其他存储库的其他权限,则可以在 `devcontainer.json` 文件中对此进行配置,并确保其他协作者具有正确的权限集。
By default, your codespace is assigned a token scoped to the repository from which it was created. When you publish a codespace that you created from a template to a new repository on {% data variables.product.product_name %}, the codespace is assigned a token scoped to the new repository. For more information, see "[Security in {% data variables.product.prodname_github_codespaces %}](/codespaces/codespaces-reference/security-in-github-codespaces#authentication)." If your project needs additional permissions for other repositories, you can configure this in the `devcontainer.json` file and ensure other collaborators have the right set of permissions.
`devcontainer.json` 文件中列出权限时,系统会提示你在为该存储库创建代码空间时查看并授予其他权限。 授予列出的权限后,{% data variables.product.prodname_github_codespaces %} 将记住你的选择,除非 `devcontainer.json` 文件中的权限发生更改,否则不会提示你进行授予。
When permissions are listed in the `devcontainer.json` file, you will be prompted to review and authorize the additional permissions as part of codespace creation for that repository. Once you've authorized the listed permissions, {% data variables.product.prodname_github_codespaces %} will remember your choice and will not prompt you for authorization unless the permissions in the `devcontainer.json` file change.
## 先决条件
## Prerequisites
若要创建定义了自定义权限的代码空间,你必须使用以下项之一:
* {% data variables.product.prodname_dotcom %} Web UI
* [{% data variables.product.prodname_dotcom %} CLI](https://github.com/cli/cli/releases/latest) 2.5.2 或更高版本
* [{% data variables.product.prodname_github_codespaces %} {% data variables.product.prodname_vscode %} 扩展](https://marketplace.visualstudio.com/items?itemName=GitHub.codespaces) 1.5.3 或更高版本
To create codespaces with custom permissions defined, you must use one of the following:
* The {% data variables.product.prodname_dotcom %} web UI
* [{% data variables.product.prodname_dotcom %} CLI](https://github.com/cli/cli/releases/latest) 2.5.2 or later
* [{% data variables.product.prodname_github_codespaces %} {% data variables.product.prodname_vscode %} extension](https://marketplace.visualstudio.com/items?itemName=GitHub.codespaces) 1.5.3 or later
## 设置其他存储库权限
## Setting additional repository permissions
1. 在 `devcontainer.json` 文件中配置 {% data variables.product.prodname_github_codespaces %} 的存储库权限。 如果存储库尚未包含 `devcontainer.json` 文件,请立即添加一个。 有关详细信息,请参阅“[将开发容器添加到项目](/codespaces/setting-up-your-project-for-codespaces/setting-up-your-project-for-codespaces)”。
1. You configure repository permissions for {% data variables.product.prodname_github_codespaces %} in the `devcontainer.json` file. If your repository does not already contain a `devcontainer.json` file, add one now. For more information, "[Add a dev container to your project](/codespaces/setting-up-your-project-for-codespaces/setting-up-your-project-for-codespaces)."
1. Edit the `devcontainer.json` file, adding the repository name and permissions needed to the `repositories` object:
1. 编辑 `devcontainer.json` 文件,添加 `repositories` 对象所需的存储库名称和权限:
```json{:copy}
{
@@ -50,25 +55,25 @@ To create codespaces with custom permissions defined, you must use one of the fo
{% note %}
**Note:** You can only reference repositories that belong to the same personal account or organization as the repository you are currently working in.
注意:只能将属于同一个人帐户或组织的存储库引用为当前正在使用的存储库。
{% endnote %}
You can grant as many or as few of the following permissions for each repository listed:
* `actions` - read / write
* `checks` - read / write
* `contents` - read / write
* `deployments` - read / write
* `discussions` - read / write
* `issues` - read / write
* `packages` - read
* `pages` - read / write
* `pull_requests` - read / write
* `repository_projects` - read / write
* `statuses` - read / write
* `workflows` - write
可以为列出的每个存储库授予任意数量的以下权限:
* `actions` - 读/写
* `checks` - 读/写
* `contents` - 读/写
* `deployments` - 读/写
* `discussions` - 读/写
* `issues` - 读/写
* `packages` - 读取
* `pages` - 读/写
* `pull_requests` - 读/写
* `repository_projects` - 读/写
* `statuses` - 读/写
* `workflows` - 写入
To set a permission for all repositories in an organization, use the `*` wildcard following your organization name in the `repositories` object.
若要为组织中的所有存储库设置权限,请在 `repositories` 对象中在组织名称后面使用 `*` 通配符。
```json
{
@@ -86,7 +91,7 @@ To create codespaces with custom permissions defined, you must use one of the fo
}
```
To set all permissions for a given repository, use `"permissions": "read-all"` or `"permissions": "write-all"` in the repository object.
若要为给定存储库设置所有权限,请在存储库对象中使用 `"permissions": "read-all"` `"permissions": "write-all"`
```json
{
@@ -102,32 +107,31 @@ To create codespaces with custom permissions defined, you must use one of the fo
}
```
## Authorizing requested permissions
## 授予请求的权限
If additional repository permissions are defined in the `devcontainer.json` file, you will be prompted to review and optionally authorize the permissions when you create a codespace or a prebuild configuration for this repository. When you authorize permissions for a repository, {% data variables.product.prodname_github_codespaces %} will not re-prompt you unless the set of requested permissions has changed for the repository.
如果在 `devcontainer.json` 文件中定义了其他存储库权限,系统会提示你在为此存储库创建 codespace 或预生成配置时查看并选择性地授予权限。 为存储库授予权限后,除非为存储库请求的权限集已更改,否则 {% data variables.product.prodname_github_codespaces %} 不会重新提示你。
![The requested permissions page](/assets/images/help/codespaces/codespaces-accept-permissions.png)
![请求的权限页](/assets/images/help/codespaces/codespaces-accept-permissions.png)
You should only authorize permissions for repositories you know and trust. If you don't trust the set of requested permissions, click **Continue without authorizing** to create the codespace with the base set of permissions. Rejecting additional permissions may impact the functionality of your project within the codespace as the codespace will only have access to the repository from which it was created.
应仅为你了解和信任的存储库授予权限。 如果你不信任请求的权限集,请单击“请继续操作,无需进行授权”以创建具有基本权限集的代码空间。 拒绝其他权限可能会影响代码空间中项目的功能,因为代码空间只能访问从中创建它的存储库。
You can only authorize permissions that your personal account already possesses. If a codespace requests permissions for repositories that you don't currently have access to, contact an owner or admin of the repository to obtain sufficient access and then try to create a codespace again.
你只能授予个人帐户已拥有的权限。 如果代码空间请求你当前无权访问的存储库的权限,请联系存储库的所有者或管理员以获取足够的访问权限,然后尝试再次创建代码空间。
## Access and security
## 访问和安全性
{% warning %}
**Deprecation note**: The access and security setting described below is now deprecated and is documented here for reference only. To enable expanded access to other repositories, add the requested permissions to your dev container definition for your codespace, as described above.
**停用说明**:下方描述的访问和安全设置现已停用,此处记录仅为参考。 若要启用对其他存储库的扩展访问权限,请将请求的权限添加到代码空间的开发容器定义,如上所述。
{% endwarning %}
When you enable access and security for a repository owned by your personal account, any codespaces that are created for that repository will have read permissions to all other repositories you own. If you want to restrict the repositories a codespace can access, you can limit to it to either the repository the codespace was opened for or specific repositories. You should only enable access and security for repositories you trust.
为个人帐户拥有的存储库启用访问和安全后,为该存储库创建的任何代码空间都将对你拥有的所有其他存储库具有读取权限。 如果要限制代码空间可以访问的仓库,您可以将其限制为代码空间打开的仓库或特定仓库。 您应该只对您信任的仓库启用访问和安全。
{% data reusables.user-settings.access_settings %}
{% data reusables.user-settings.codespaces-tab %}
1. Under "Access and security", select the setting you want for your personal account.
{% data reusables.user-settings.access_settings %} {% data reusables.user-settings.codespaces-tab %}
1. 在“访问和安全”下,为个人帐户选择所需的设置。
![Radio buttons to manage trusted repositories](/assets/images/help/settings/codespaces-access-and-security-radio-buttons.png)
![管理信任仓库的单选按钮](/assets/images/help/settings/codespaces-access-and-security-radio-buttons.png)
1. If you chose "Selected repositories", select the dropdown menu, then click a repository to allow the repository's codespaces to access other repositories you own. Repeat for all repositories whose codespaces you want to access other repositories you own.
1. 如果选择了“所选存储库”,请选择下拉菜单,然后单击一个存储库,以允许该存储库的 codespace 访问你拥有的其他存储库。 对于您要允许其代码空间访问您拥有的其他仓库的所有仓库重复此操作。
!["Selected repositories" dropdown menu](/assets/images/help/settings/codespaces-access-and-security-repository-drop-down.png)
![“所选存储库”下拉菜单](/assets/images/help/settings/codespaces-access-and-security-repository-drop-down.png)

View File

@@ -1,7 +1,7 @@
---
title: Reviewing your security logs for GitHub Codespaces
title: 查看 GitHub Codespaces 的安全日志
shortTitle: Security logs
intro: 'You can use the security log to review all actions related to {% data variables.product.prodname_github_codespaces %}.'
intro: '你可以使用安全日志查看与 {% data variables.product.prodname_github_codespaces %} 相关的所有操作。'
versions:
fpt: '*'
ghec: '*'
@@ -11,19 +11,22 @@ topics:
- Security
redirect_from:
- /codespaces/managing-your-codespaces/reviewing-your-security-logs-for-codespaces
ms.openlocfilehash: 51cd11f123cbc2b6b67e089d65bc68d3441aa5b8
ms.sourcegitcommit: e8c012864f13f9146e53fcb0699e2928c949ffa8
ms.translationtype: HT
ms.contentlocale: zh-CN
ms.lasthandoff: 11/09/2022
ms.locfileid: '148159478'
---
## 关于 {% data variables.product.prodname_github_codespaces %} 的安全日志
当你在个人帐户拥有的存储库中执行与 {% data variables.product.prodname_github_codespaces %} 相关的操作时,你可以查看安全日志中的操作。 有关访问日志的详细信息,请参阅“[查看安全日志](/github/authenticating-to-github/reviewing-your-security-log#accessing-your-security-log)”。
## About security logs for {% data variables.product.prodname_github_codespaces %}
![包含代码空间信息的安全日志](/assets/images/help/settings/codespaces-audit-log.png)
When you perform an action related to {% data variables.product.prodname_github_codespaces %} in repositories owned by your personal account, you can review the actions in the security log. For information about accessing the log, see "[Reviewing your security log](/github/authenticating-to-github/reviewing-your-security-log#accessing-your-security-log)."
安全日志包括发生了什么操作以及何时执行的操作等详细信息。 有关 {% data variables.product.prodname_github_codespaces %} 操作的信息,请参阅“[{% data variables.product.prodname_codespaces %} 类别操作](/github/authenticating-to-github/reviewing-your-security-log#codespaces-category-actions)”。
![security log with Codespaces information](/assets/images/help/settings/codespaces-audit-log.png)
## 延伸阅读
The security log includes details on what action occurred and when you performed it. For information about {% data variables.product.prodname_github_codespaces %} actions, see "[{% data variables.product.prodname_codespaces %} category actions](/github/authenticating-to-github/reviewing-your-security-log#codespaces-category-actions)".
## Further reading
- "[Reviewing your organization's audit logs for {% data variables.product.prodname_github_codespaces %}](/codespaces/managing-codespaces-for-your-organization/reviewing-your-organizations-audit-logs-for-github-codespaces)"
- "[{% data variables.product.prodname_github_codespaces %} logs](/codespaces/troubleshooting/github-codespaces-logs)"
- “[查看 {% data variables.product.prodname_github_codespaces %} 的组织审核日志](/codespaces/managing-codespaces-for-your-organization/reviewing-your-organizations-audit-logs-for-github-codespaces)”
- “[{% data variables.product.prodname_github_codespaces %} 日志](/codespaces/troubleshooting/github-codespaces-logs)”

View File

@@ -15,12 +15,12 @@ versions:
type: overview
topics:
- Codespaces
ms.openlocfilehash: a1618c86671bc5b06474c41803c6b34576a897aa
ms.sourcegitcommit: 2e1852bcdd690cb66b9b5d69cb056a2bb2b9a6b4
ms.openlocfilehash: 9d01df3f8dae7ceb788e2dd57b02fb3cc977400d
ms.sourcegitcommit: 1529de77bfcbe45519131b5f5fb3ab319758c2d2
ms.translationtype: HT
ms.contentlocale: zh-CN
ms.lasthandoff: 11/10/2022
ms.locfileid: '148160798'
ms.lasthandoff: 11/14/2022
ms.locfileid: '148164321'
---
## 什么是代码空间?
@@ -50,7 +50,7 @@ ms.locfileid: '148160798'
组织所有者可以启用 {% data variables.product.prodname_github_codespaces %},后者可按照组织或企业帐户计费。 这适用于通过组织拥有的存储库创建的 codespaces。 有关详细信息,请参阅“[为组织启用 {% data variables.product.prodname_github_codespaces %}](/codespaces/managing-codespaces-for-your-organization/enabling-github-codespaces-for-your-organization)”。 可以对组织或企业帐户上的 {% data variables.product.prodname_github_codespaces %} 使用设置支出限制。 有关详细信息,请参阅“[管理 {% data variables.product.prodname_github_codespaces %} 的支出限制](/billing/managing-billing-for-github-codespaces/managing-the-spending-limit-for-github-codespaces)”。
如果按照组织或企业对 codespace 的使用进行计费,则会在创建 codespace 时显示。 有关详细信息,请参阅“[为存储库创建 codespace](/codespaces/developing-in-codespaces/creating-a-codespace-for-a-repository#creating-a-codespace-for-a-repository)”。 按照组织或其父企业计费的 codespaces 归组织所有,且可被组织所有者删除。 有关详细信息,请参阅“[删除 codespace](/codespaces/developing-in-codespaces/deleting-a-codespace#deleting-codespaces-in-your-organization)”。
如果按照组织或企业对 codespace 的使用进行计费,则会在创建 codespace 时显示。 有关详细信息,请参阅“[为存储库创建 codespace](/codespaces/developing-in-codespaces/creating-a-codespace-for-a-repository#creating-a-codespace-for-a-repository)”。 按照组织或其父企业计费的 codespace 归组织所有,且可被组织所有者删除。 有关详细信息,请参阅“[删除 codespace](/codespaces/developing-in-codespaces/deleting-a-codespace#deleting-codespaces-in-your-organization)”。
### 自定义 {% data variables.product.prodname_github_codespaces %}

View File

@@ -1,7 +1,7 @@
---
title: About GitHub Codespaces prebuilds
title: 关于 GitHub Codespaces 预生成
shortTitle: About prebuilds
intro: '{% data variables.product.prodname_github_codespaces %} prebuilds help to speed up the creation of new codespaces for large or complex repositories.'
intro: '{% data variables.product.prodname_github_codespaces %} 预生成有助于加快为大型或复杂存储库创建新的 codespace 的速度。'
versions:
fpt: '*'
ghec: '*'
@@ -9,43 +9,48 @@ topics:
- Codespaces
redirect_from:
- /codespaces/prebuilding-your-codespaces/about-codespaces-prebuilds
ms.openlocfilehash: e0962e410f2227a23ff98c8a3e7995ea8ec8a914
ms.sourcegitcommit: e8c012864f13f9146e53fcb0699e2928c949ffa8
ms.translationtype: HT
ms.contentlocale: zh-CN
ms.lasthandoff: 11/09/2022
ms.locfileid: '148158795'
---
## Overview
## 概述
{% data reusables.codespaces.prebuilds-definition %}
If it currently takes more than 2 minutes to create a codespace for a repository, you are likely to benefit from using prebuilds. This is because, with a prebuild, any source code, editor extensions, project dependencies, commands, and configurations have already been downloaded, installed, and applied before you create a codespace.
如果当前为存储库创建 codespace 的时间超过 2 分钟,则使用预生成可能会更好。 这是因为,使用预生成,会在创建 codespace 之前下载、安装和应用任何源代码、编辑器扩展、项目依赖项、命令和配置。
By default, whenever you push changes to your repository, {% data variables.product.prodname_github_codespaces %} uses {% data variables.product.prodname_actions %} to automatically update your prebuilds.
默认情况下,每当将更改推送到存储库时,{% data variables.product.prodname_github_codespaces %} 都会使用 {% data variables.product.prodname_actions %} 自动更新预生成。
When prebuilds are available for a particular branch of a repository, a particular dev container configuration file, and for your region, you'll see the "{% octicon "zap" aria-label="The zap icon" %} Prebuild ready" label in the list of machine type options when you create a codespace. If a prebuild is still being created, you will see the "{% octicon "history" aria-label="The history icon" %} Prebuild in progress" label. For more information, see "[Creating a codespace for a repository](/codespaces/developing-in-codespaces/creating-a-codespace-for-a-repository#creating-a-codespace-for-a-repository)."
当预生成可用于存储库的特定分支、特定开发容器配置文件和你所在的区域时,你会在创建 codespace 时在计算机类型选项列表中看到“{% octicon "zap" aria-label="The zap icon" %} 预生成就绪”标签。 如果仍在创建预生成,你将看到“{% octicon "history" aria-label="The history icon" %}正在进行预生成”标签。 有关详细信息,请参阅“[为存储库创建 codespace](/codespaces/developing-in-codespaces/creating-a-codespace-for-a-repository#creating-a-codespace-for-a-repository)”。
![The dialog box for choosing a machine type](/assets/images/help/codespaces/choose-custom-machine-type.png)
![用于选择计算机类型的对话框](/assets/images/help/codespaces/choose-custom-machine-type.png)
When you create a codespace from a template on the "Your codespaces" page, {% data variables.product.prodname_dotcom %} may automatically use a prebuild to speed up creation time. For more information on templates, see "[Creating a codespace from a template](/codespaces/developing-in-codespaces/creating-a-codespace-from-a-template)."
根据“你的 codespace”页面上的模板创建 codespace 时,{% data variables.product.prodname_dotcom %} 可能会自动使用预生成来加快创建时间。 有关模板的详细信息,请参阅“[根据模板创建 codespace](/codespaces/developing-in-codespaces/creating-a-codespace-from-a-template)”。
## The prebuild process
## 预生成过程
To create a prebuild you set up a prebuild configuration. When you save the configuration, a {% data variables.product.prodname_actions %} workflow runs to create each of the required prebuilds; one workflow per prebuild. Workflows also run whenever the prebuilds for your configuration need to be updated. This can happen at scheduled intervals, on pushes to a prebuild-enabled repository, or when you change the dev container configuration. For more information, see "[Configuring prebuilds](/codespaces/prebuilding-your-codespaces/configuring-prebuilds#configuring-prebuilds)."
若要创建预生成,请设置预生成配置。 保存配置时,将运行 {% data variables.product.prodname_actions %} 工作流以创建每个所需的预生成;每个预生成一个工作流。 每当需要更新配置的预生成时,也会运行工作流。 在计划时间间隔、推送到已启用预生成的存储库时或更改开发容器配置时可能会发生这种情况。 有关详细信息,请参阅“[配置预生成](/codespaces/prebuilding-your-codespaces/configuring-prebuilds#configuring-prebuilds)”。
When a prebuild configuration workflow runs, {% data variables.product.prodname_dotcom %} creates a temporary codespace, performing setup operations up to and including any `onCreateCommand` and `updateContentCommand` commands in the `devcontainer.json` file. No `postCreateCommand` commands are run during the creation of a prebuild. For more information about these commands, see the [`devcontainer.json` reference](https://code.visualstudio.com/docs/remote/devcontainerjson-reference#_devcontainerjson-properties) in the {% data variables.product.prodname_vscode_shortname %} documentation. A snapshot of the generated container is then taken and stored.
运行预生成配置工作流时,{% data variables.product.prodname_dotcom %} 会创建临时 codespace从而执行直到 `devcontainer.json` 文件中的任何 `onCreateCommand` `updateContentCommand` 命令(含)的设置操作。 在创建预生成期间不会运行任何 `postCreateCommand` 命令。 有关使用这些命令的详细信息,请参阅 {% data variables.product.prodname_vscode_shortname %} 文档中的 [`devcontainer.json` 参考](https://code.visualstudio.com/docs/remote/devcontainerjson-reference#_devcontainerjson-properties)。 然后创建并存储生成的容器的快照。
As with other {% data variables.product.prodname_actions %} workflows, running a prebuild configuration workflow will either consume some of the {% data variables.product.prodname_actions %} minutes included with your account, if you have any, or it will incur charges for {% data variables.product.prodname_actions %} minutes. Storage of codespace prebuilds is billed in the same way as storage of active or stopped codespaces. For more information, see "[About billing for {% data variables.product.prodname_github_codespaces %}](/billing/managing-billing-for-github-codespaces/about-billing-for-github-codespaces#billing-for-codespaces-prebuilds)."
与其他 {% data variables.product.prodname_actions %} 工作流一样,运行预生成配置工作流会占用帐户中包含的一些 {% data variables.product.prodname_actions %} 分钟(如果有),或者会产生 {% data variables.product.prodname_actions %} 分钟的费用。 存储 codespace 预生成的计费方式与存储活动或已停止的 codespace 相同。 有关详细信息,请参阅“[关于 {% data variables.product.prodname_github_codespaces %} 的计费](/billing/managing-billing-for-github-codespaces/about-billing-for-github-codespaces#billing-for-codespaces-prebuilds)”。
When you create a codespace from a prebuild, {% data variables.product.prodname_dotcom %} downloads the existing container snapshot from storage and deploys it on a fresh virtual machine, completing the remaining commands specified in the dev container configuration. Since many operations have already been performed, such as cloning the repository, creating a codespace from a prebuild can be substantially quicker than creating one without a prebuild. This is true where the repository is large and/or `onCreateCommand` commands take a long time to run.
从预生成创建 codespace 时,{% data variables.product.prodname_dotcom %} 从存储下载现有容器快照,并将其部署到全新的虚拟机上,从而完成开发容器配置中指定的剩余命令。 由于已执行许多操作(例如克隆存储库),因此从预生成创建 codespace 可能比在没有预生成的情况下创建 codespace 要快得多。 存储库很大和/或 `onCreateCommand` 命令的运行时间很长时会出现这种情况。
## About pushing changes to prebuild-enabled branches
## 关于将更改推送到已启用预生成的分支
By default, each push to a branch that has a prebuild configuration results in a {% data variables.product.prodname_dotcom %}-managed {% data variables.product.prodname_actions %} workflow run to update the prebuild. The prebuild workflow has a concurrency limit of one workflow run at a time for a given prebuild configuration, unless changes were made that affect the dev container configuration for the associated repository. For more information, see "[Introduction to dev containers](/codespaces/setting-up-your-project-for-codespaces/introduction-to-dev-containers)." If a run is already in progress, the workflow run that was queued most recently queued will run next, after the current run completes.
默认情况下,每次推送到有预生成配置的分支,都会运行一个 {% data variables.product.prodname_dotcom %} 托管的 {% data variables.product.prodname_actions %} 工作流来更新预生成。 预生成工作流有一个并发限制,即,对于一个给定的预生成配置,一次只能运行一个工作流,除非进行的更改影响到相关存储库的开发容器配置。 有关详细信息,请参阅“[开发容器简介](/codespaces/setting-up-your-project-for-codespaces/introduction-to-dev-containers)”。 如果运行已在进行中,则最近排队的工作流运行将在当前运行完成后运行。
With the prebuild set to be updated on each push, it means that if there are very frequent pushes to your repository, prebuild updates will occur at least as often as it takes to run the prebuild workflow. That is, if your workflow run typically takes one hour to complete, prebuilds will be created for your repository roughly hourly, if the run succeeds, or more often if there were pushes that change the dev container configuration on the branch.
将预生成设置为在每次推送时更新,意味着如果存储库中存在非常频繁的推送,预生成更新将至少与运行预生成工作流所需的频率一样频繁。 也就是说,如果工作流运行通常需要一个小时才能完成且运行成功,那么大约每小时会为存储库创建一次预生成,如果分支上有更改开发容器配置的推送,则创建预生成会更频繁。
For example, let's imagine 5 pushes are made, in quick succession, against a branch that has a prebuild configuration. In this situation:
例如,假设针对有预生成配置的分支连续进行 5 次推送。 在这种情况下:
* A workflow run is started for the first push, to update the prebuild.
* If the 4 remaining pushes do not affect the dev container configuration, the workflow runs for these are queued in a "pending" state.
* 在第一次推送中会启动工作流运行,以更新预生成。
* 如果余下的 4 次推送不会影响开发容器配置,这些工作流运行将以“挂起”状态排队。
If any of the remaining 4 pushes change the dev container configuration, then the service will not skip that one and will immediately run the prebuild creation workflow, updating the prebuild accordingly if it succeeds.
如果余下 4 次推送中的任何一次更改了开发容器配置,服务将不会跳过该推送,并将立即运行预生成创建工作流,运行成功后将相应地更新预生成。
* Once the first run completes, workflow runs for pushes 2, 3, and 4 will be canceled, and the last queued workflow (for push 5) will run and update the prebuild.
* 首次运行完成后,将取消第 2、3 和 4 次推送的工作流运行,最后排队的工作流(第 5 次推送)将运行并更新预生成。

View File

@@ -1,7 +1,7 @@
---
title: Managing prebuilds
title: 管理预生成
shortTitle: Manage prebuilds
intro: 'You can review, modify, and delete the prebuild configurations for your repository.'
intro: 你可以查看、修改和删除存储库的预生成配置。
versions:
fpt: '*'
ghec: '*'
@@ -9,90 +9,95 @@ type: how_to
topics:
- Codespaces
miniTocMaxHeadingLevel: 3
ms.openlocfilehash: f39c46d91193db4c1c44ab336d86024b40adcea4
ms.sourcegitcommit: e8c012864f13f9146e53fcb0699e2928c949ffa8
ms.translationtype: HT
ms.contentlocale: zh-CN
ms.lasthandoff: 11/09/2022
ms.locfileid: '148159514'
---
## 检查、更改和删除预生成配置
## Checking, changing, and deleting your prebuild configurations
为存储库配置的预生成是使用 {% data variables.product.prodname_actions %} 工作流(由 {% data variables.product.prodname_github_codespaces %} 服务管理)创建和更新的。
The prebuilds that you configure for a repository are created and updated using a {% data variables.product.prodname_actions %} workflow, managed by the {% data variables.product.prodname_github_codespaces %} service.
根据预生成配置中的设置,更新预生成的工作流可能会由以下事件触发:
Depending on the settings in a prebuild configuration, the workflow to update the prebuild may be triggered by these events:
* 创建或更新预生成配置
* 将提交或拉取请求推送到配置为具有预生成的分支
* 更改任何开发容器配置文件
* 在预生成配置中定义的计划
* 手动触发工作流
* Creating or updating the prebuild configuration
* Pushing a commit or a pull request to a branch that's configured to have prebuilds
* Changing any of the dev container configuration files
* A schedule that you've defined in the prebuild configuration
* Manually triggering the workflow
预生成配置中的设置确定哪些事件会自动触发预生成的更新。 有关详细信息,请参阅“[配置预生成](/codespaces/prebuilding-your-codespaces/configuring-prebuilds#configuring-prebuilds)”。
The settings in the prebuild configuration determine which events automatically trigger an update of the prebuild. For more information, see "[Configuring prebuilds](/codespaces/prebuilding-your-codespaces/configuring-prebuilds#configuring-prebuilds)."
具有存储库管理员访问权限的人员可以检查预生成的进度以及编辑和删除预生成配置。
People with admin access to a repository can check the progress of prebuilds, edit, and delete prebuild configurations.
### 查看预生成的进度
可以在存储库设置的 {% data variables.product.prodname_github_codespaces %} 页上查看所设置的每个预生成配置的最新工作流运行的当前状态。 例如“当前正在运行”或“1 小时前最后一次运行”。
### Viewing the progress of prebuilds
You can view the current status of the latest workflow run for each prebuild configuration you've set up on the {% data variables.product.prodname_github_codespaces %} page of your repository settings. For example, "Currently running" or "Last run 1 hour ago."
若要查看最新预生成工作流运行的日志输出,请单击“查看输出”。
To see the log output for the latest prebuild workflow run, click **See output**.
![“查看输出”按钮](/assets/images/help/codespaces/prebuilds-see-output.png)
![The 'See output' button](/assets/images/help/codespaces/prebuilds-see-output.png)
这会在“操作”选项卡中显示工作流的最近一次运行的输出。
This displays the output of the most recent run of the workflow in the **Actions** tab.
![预生成工作流输出](/assets/images/help/codespaces/prebuilds-log-output.png)
![The prebuild workflow output](/assets/images/help/codespaces/prebuilds-log-output.png)
或者,若要查看与指定分支关联的所有预生成工作流运行,请单击省略号按钮,然后从下拉菜单中选择“查看运行”。
Alternatively, to view all prebuild workflow runs associated with the specified branch, click the ellipsis button and choose **View runs** from the dropdown menu.
![下拉菜单中的“查看运行”选项](/assets/images/help/codespaces/prebuilds-view-runs.png)
![The 'View runs' option in the dropdown menu](/assets/images/help/codespaces/prebuilds-view-runs.png)
这将显示关联分支的预生成工作流运行历史记录。
This displays the workflow run history for prebuilds for the associated branch.
![工作流运行历史记录](/assets/images/help/codespaces/prebuilds-workflow-runs.png)
![The workflow run history](/assets/images/help/codespaces/prebuilds-workflow-runs.png)
### 编辑预生成配置
### Editing a prebuild configuration
1. On the {% data variables.product.prodname_codespaces %} page of your repository settings, click the ellipsis to the right of the prebuild configuration you want to edit.
1. In the dropdown menu, click **Edit**.
1. 在存储库设置的 {% data variables.product.prodname_codespaces %} 页上,单击要编辑的预生成配置右侧的省略号。
1. 在下拉菜单中,单击“编辑”。
![The 'Edit' option in the dropdown menu](/assets/images/help/codespaces/prebuilds-edit.png)
![下拉菜单中的“编辑”选项](/assets/images/help/codespaces/prebuilds-edit.png)
1. Make the required changes to the prebuild configuration, then click **Update**.
1. 对预生成配置进行所需的更改,然后单击“更新”。
{% data reusables.codespaces.prebuilds-permission-authorization %}
### Disabling a prebuild configuration
### 禁用预生成配置
To pause the update of prebuilds for a configuration, you can disable workflow runs for the configuration. Disabling the workflow runs for a prebuild configuration does not delete any previously created prebuilds for that configuration and, as a result, codespaces will continue to be generated from an existing prebuild.
若要暂停更新配置的预生成,可以禁用配置的工作流运行。 为预生成配置禁用工作流运行不会删除以前为该配置创建的任何预生成因此codespace 将继续从现有预生成生成。
Disabling the workflow runs for a prebuild configuration is useful if you need to investigate prebuild creation failures.
如果需要调查预生成创建失败,则禁用预生成配置的工作流运行非常有用。
1. On the {% data variables.product.prodname_codespaces %} page of your repository settings, click the ellipsis to the right of the prebuild configuration you want to disable.
1. In the dropdown menu, click **Disable runs**.
1. 在存储库设置的 {% data variables.product.prodname_codespaces %} 页上,单击要禁用的预生成配置右侧的省略号。
1. 在下拉菜单中,单击“禁用运行”。
![The 'Disable runs' option in the dropdown menu](/assets/images/help/codespaces/prebuilds-disable.png)
![下拉菜单中的“禁用运行”选项](/assets/images/help/codespaces/prebuilds-disable.png)
1. To confirm that you want to disable this configuration, click **OK**.
1. 若确认要禁用此配置,请单击“确定”。
### Deleting a prebuild configuration
### 删除预生成配置
Deleting a prebuild configuration also deletes all previously created prebuilds for that configuration. As a result, shortly after you delete a configuration, prebuilds generated by that configuration will no longer be available when you create a new codespace.
删除预生成配置还会删除以前为该配置创建的所有预生成。 因此,删除配置后不久,在创建新 codespace 时,该配置生成的预生成将不再可用。
After you delete a prebuild configuration, workflow runs for that configuration that have been queued or started will still run. They will be listed in the workflow run history, along with previously completed workflow runs.
删除预生成配置后,该配置已排队或启动的工作流仍将运行。 它们将连同以前完成的工作流运行一起列在工作流运行历史记录中。
1. On the {% data variables.product.prodname_codespaces %} page of your repository settings, click the ellipsis to the right of the prebuild configuration you want to delete.
1. In the dropdown menu, click **Delete**.
1. 在存储库设置的 {% data variables.product.prodname_codespaces %} 页上,单击要删除的预生成配置右侧的省略号。
1. 在下拉菜单中,单击“删除”。
![The 'Delete' option in the dropdown menu](/assets/images/help/codespaces/prebuilds-delete.png)
![下拉菜单中的“删除”选项](/assets/images/help/codespaces/prebuilds-delete.png)
1. Click **OK** to confirm the deletion.
1. 单击“确定”确认删除操作。
### Manually trigger prebuilds
### 手动触发预生成
It may be useful to manually trigger a workflow run for a prebuild configuration. Generally this is only necessary if you are debugging a problem with the workflow for a prebuild configuration.
手动触发预生成配置的工作流运行可能很有用。 通常,只有在调试预生成配置的工作流的问题时,才有必要这样做。
1. On the {% data variables.product.prodname_codespaces %} page of your repository settings, click the ellipsis to the right of the prebuild configuration whose workflow you want to trigger.
1. In the dropdown menu, click **Manually trigger**.
1. 在存储库设置的 {% data variables.product.prodname_codespaces %} 页上,单击要触发其工作流的预生成配置右侧的省略号。
1. 在下拉菜单中,单击“手动触发”。
![The 'Manually trigger' option in the dropdown menu](/assets/images/help/codespaces/prebuilds-manually-trigger.png)
![下拉菜单中的“手动触发”选项](/assets/images/help/codespaces/prebuilds-manually-trigger.png)
## Further reading
## 延伸阅读
- "[Troubleshooting prebuilds](/codespaces/troubleshooting/troubleshooting-prebuilds)"
- [对预生成进行故障排除](/codespaces/troubleshooting/troubleshooting-prebuilds)

View File

@@ -1,8 +1,8 @@
---
title: Testing dev container configuration changes on a prebuild-enabled branch
title: 在已启用预生成的分支上测试开发容器配置更改
shortTitle: Test dev container changes
allowTitleToDifferFromFilename: true
intro: When you change the dev container configuration for a branch that's enabled for prebuilds you should test your changes in a codespace.
intro: 更改为预生成启用的分支的开发容器配置时,应在 codespace 中测试更改。
versions:
fpt: '*'
ghec: '*'
@@ -11,22 +11,27 @@ topics:
- Codespaces
- Set up
permissions: People with write permissions to a repository can create or edit the dev container configuration for a branch.
ms.openlocfilehash: 29b44d0fb0b3bb3211f0c204cc7e99e39ab89b79
ms.sourcegitcommit: e8c012864f13f9146e53fcb0699e2928c949ffa8
ms.translationtype: HT
ms.contentlocale: zh-CN
ms.lasthandoff: 11/09/2022
ms.locfileid: '148159423'
---
对已启用预生成的分支的开发容器配置所做的任何更改都会导致对 codespace 配置和关联的预生成进行更新。 因此,在将更改提交到主动使用的存储库分支之前,在 codespace 中从测试分支测试此类更改非常重要。 这将确保你不会为团队引入中断性变更。
Any changes you make to the dev container configuration for a prebuild-enabled branch will result in an update to the codespace configuration and the associated prebuild. Its therefore important to test such changes in a codespace from a test branch before committing your changes to a branch of your repository that's actively used. This will ensure youre not introducing breaking changes for your team.
有关详细信息,请参阅“[开发容器简介](/codespaces/setting-up-your-project-for-codespaces/introduction-to-dev-containers)”。
For more information, see "[Introduction to dev containers](/codespaces/setting-up-your-project-for-codespaces/introduction-to-dev-containers)."
## 测试对开发容器配置的更改
## Testing changes to the dev container configuration
1. Create a codespace from the prebuild-enabled branch whose dev container you want to change. For more information, see "[Creating a codespace for a repository](/codespaces/developing-in-codespaces/creating-a-codespace-for-a-repository#creating-a-codespace-for-a-repository)."
1. In the codespace, check out a test branch. For more information, see "[Using source control in your codespace](/codespaces/developing-in-codespaces/using-source-control-in-your-codespace#creating-or-switching-branches)."
1. Make the required changes to the dev container configuration.
1. Apply the changes by rebuilding the container. For more information, see "[Introduction to dev containers](/codespaces/setting-up-your-project-for-codespaces/introduction-to-dev-containers#applying-configuration-changes-to-a-codespace)."
1. After everything looks good, we also recommend creating a new codespace from your test branch to ensure everything is working. You can then commit your changes to your repository's default branch, or an active feature branch, triggering an update of the prebuild for that branch.
1. 从想要更改其开发容器的已启用预生成的分支中创建 codespace。 有关详细信息,请参阅“[为存储库创建 codespace](/codespaces/developing-in-codespaces/creating-a-codespace-for-a-repository#creating-a-codespace-for-a-repository)”。
1. 在 codespace 中,签出测试分支。 有关详细信息,请参阅[在 codespace 中使用源代码管理](/codespaces/developing-in-codespaces/using-source-control-in-your-codespace#creating-or-switching-branches)。
1. 对开发容器配置进行所需的更改。
1. 通过重新生成容器来应用更改。 有关详细信息,请参阅“[开发容器简介](/codespaces/setting-up-your-project-for-codespaces/introduction-to-dev-containers#applying-configuration-changes-to-a-codespace)”。
1. 一切正常之后,我们还建议从测试分支创建新的 codespace以确保一切正常工作。 然后,可以将更改提交到存储库的默认分支或活动功能分支,从而触发该分支的预生成的更新。
{% note %}
**Note**: Creating this codespace will take longer than usual because it will not be created from a prebuild.
注意:创建此 codespace 所需的时间比平时长,因为它不会从预生成创建。
{% endnote %}

View File

@@ -0,0 +1,79 @@
---
title: Adding features to a devcontainer.json file
shortTitle: Adding features
intro: With features, you can quickly add tools, runtimes, or libraries to your dev container configuration.
allowTitleToDifferFromFilename: true
versions:
fpt: '*'
ghec: '*'
type: how_to
topics:
- Codespaces
- Set up
---
{% data reusables.codespaces.about-features %} Use the tabs in this article to display instructions for each of these ways of adding features.
## Adding features to a `devcontainer.json` file
{% webui %}
1. Navigate to your repository on {% data variables.product.prodname_dotcom_the_website %}, find your `devcontainer.json` file, and click {% octicon "pencil" aria-label="The edit icon" %} to edit the file.
If you don't already have a `devcontainer.json` file, you can create one now. For more information, see "[Introduction to dev containers](/codespaces/setting-up-your-project-for-codespaces/introduction-to-dev-containers#creating-a-custom-dev-container-configuration)."
1. To the right of the file editor, in the **Marketplace** tab, browse or search for the feature you want to add, then click the name of the feature.
![Screenshot of the Terraform feature in the Marketplace tab, with "Terra" in the search bar](/assets/images/help/codespaces/feature-marketplace.png)
3. Under "Installation," click the code snippet to copy it to your clipboard, then paste the snippet into the `features` object in your `devcontainer.json` file.
![Screenshot of a code block in the Installation section of the Marketplace tab](/assets/images/help/codespaces/feature-installation-code.png)
```JSON
"features": {
...
"ghcr.io/devcontainers/features/terraform:1": {},
...
}
```
1. By default, the latest version of the feature will be used. To choose a different version, or configure other options for the feature, expand the properties listed under "Options" to view the available values, then add the options by manually editing the object in your `devcontainer.json` file.
![Screenshot of the Options section of the Marketplace tab, with "version" and "tflint" expanded](/assets/images/help/codespaces/feature-options.png)
```JSON
"features": {
...
"ghcr.io/devcontainers/features/terraform:1": {
"version": "1.1",
"tflint": "latest"
},
...
}
```
1. Commit the changes to your `devcontainer.json` file.
The configuration changes will take effect in new codespaces created from the repository. To make the changes take effect in existing codespaces, you will need to pull the updates to the `devcontainer.json` file into your codespace, then rebuild the container for the codespace. For more information, see "[Introduction to dev containers](/codespaces/setting-up-your-project-for-codespaces/introduction-to-dev-containers#applying-configuration-changes-to-a-codespace)."
{% endwebui %}
{% vscode %}
{% note %}
To add features in {% data variables.product.prodname_vscode_shortname %} while you are working locally, and not connected to a codespace, you must have the "Dev Containers" extension installed and enabled. For more information about this extension, see the [{% data variables.product.prodname_vs_marketplace_shortname %}](https://marketplace.visualstudio.com/items?itemName=ms-vscode-remote.remote-containers).
{% endnote %}
{% data reusables.codespaces.command-pallette %}
2. Start typing "Configure" and select **Codespaces: Configure Dev Container Features**.
![The Configure Devcontainer Features command in the Command Palette](/assets/images/help/codespaces/codespaces-configure-features.png)
3. Update your feature selections, then click **OK**.
![The select additional features menu during container configuration](/assets/images/help/codespaces/select-additional-features.png)
4. If you're working in a codespace, a prompt will appear in the lower-right corner. To rebuild the container and apply the changes to the codespace you're working in, click **Rebuild Now**.
!["Codespaces: Rebuild Container" in the Command Palette](/assets/images/help/codespaces/rebuild-prompt.png)
{% endvscode %}

View File

@@ -1,6 +1,6 @@
---
title: Introduction to dev containers
intro: 'When you work in a codespace, the environment you are working in is created using a development container, or dev container, hosted on a virtual machine.'
title: 开发容器简介
intro: 在 codespace 中工作时,你工作所处的环境是使用托管在虚拟机上的开发容器创建的。
permissions: People with write permissions to a repository can create or edit the codespace configuration.
redirect_from:
- /github/developing-online-with-github-codespaces/configuring-github-codespaces-for-your-project
@@ -16,71 +16,76 @@ topics:
- Codespaces
- Set up
- Fundamentals
ms.openlocfilehash: 0b47f0292eb3a13467a8227ac323d289f9712223
ms.sourcegitcommit: e8c012864f13f9146e53fcb0699e2928c949ffa8
ms.translationtype: HT
ms.contentlocale: zh-CN
ms.lasthandoff: 11/09/2022
ms.locfileid: '148158771'
---
## 关于开发容器
## About dev containers
开发容器是 Docker 容器,是为了提供功能齐全的开发环境专门配置的。 只要在 codespace 中运作,都是在虚拟机上使用开发容器。
Development containers, or dev containers, are Docker containers that are specifically configured to provide a fully featured development environment. Whenever you work in a codespace, you are using a dev container on a virtual machine.
可以为存储库配置开发容器,以便为该存储库创建的 codespace 能够为你提供定制的开发环境,其中包含处理特定项目所需的所有工具和运行时。 如果未在存储库中定义配置,则 {% data variables.product.prodname_github_codespaces %} 使用默认配置,其中包含团队在开发项目时可能需要的许多常用工具。 有关详细信息,请参阅“[使用默认开发容器配置](#using-the-default-dev-container-configuration)”。
You can configure the dev container for a repository so that codespaces created for that repository give you a tailored development environment, complete with all the tools and runtimes you need to work on a specific project. If you don't define a configuration in the repository then {% data variables.product.prodname_github_codespaces %} uses a default configuration, which contains many of the common tools that your team might need for development with your project. For more information, see "[Using the default dev container configuration](#using-the-default-dev-container-configuration)."
开发容器的配置文件包含在存储库的 `.devcontainer` 目录中。 可以使用 {% data variables.product.prodname_vscode %} 为你添加配置文件。 可以从各种项目类型的预定义配置中进行选择。 无需进一步配置即可使用这些配置,也可以编辑这些配置以优化它们生成的开发环境。 有关详细信息,请参阅“[使用预定义的开发容器配置](#using-a-predefined-dev-container-configuration)”。
The configuration files for a dev container are contained in a `.devcontainer` directory in your repository. You can use {% data variables.product.prodname_vscode %} to add configuration files for you. You can choose from a selection of predefined configurations for various project types. You can use these without further configuration, or you can edit the configurations to refine the development environment they produce. For more information, see "[Using a predefined dev container configuration](#using-a-predefined-dev-container-configuration)."
或者,可以添加自己的自定义配置文件。 有关详细信息,请参阅“[创建自定义开发容器配置](#creating-a-custom-dev-container-configuration)”。
Alternatively, you can add your own custom configuration files. For more information, see "[Creating a custom dev container configuration](#creating-a-custom-dev-container-configuration)."
可以为存储库定义单个开发容器配置、为不同分支定义不同配置或多个配置。 当有多个配置可用时,用户可以在创建 codespace 时选择其首选配置。 这对于包含不同编程语言或不同项目的源代码的大型存储库尤其有用。 你可以创建一个配置选择,允许不同的团队使用为他们正在进行的工作设置的相应 codespace。
You can define a single dev container configuration for a repository, different configurations for different branches, or multiple configurations. When multiple configurations are available, users can choose their preferred configuration when they create a codespace. This is particularly useful for large repositories that contain source code in different programming languages or for different projects. You can create a choice of configurations that allow different teams to work in a codespace that's set up appropriately for the work they are doing.
When you create a codespace from a template, you might start with one or more dev container configuration files in your workspace. To configure your environment further, you can add or remove settings from these files and rebuild the container to apply the changes to the codespace you're working in. If you publish your codespace to a repository on {% data variables.product.product_name %}, then any codespaces created from that repository will share the configuration you've defined. For more information, see "[Applying configuration changes to a codespace](#applying-configuration-changes-to-a-codespace)" and "[Creating a codespace from a template](/codespaces/developing-in-codespaces/creating-a-codespace-from-a-template#publishing-to-a-remote-repository)."
根据模板创建 codespace 时,可以从工作区中的一个或多个开发容器配置文件开始。 若要进一步配置环境,可以从这些文件添加或删除设置,并重新生成容器,将更改应用到你正在使用的 codespace。 如果将 codespace 发布到 {% data variables.product.product_name %} 上的存储库,则从该存储库创建的任何 codespace 都将共享已定义的配置。 有关详细信息,请参阅“[将配置更改应用于 codespace](#applying-configuration-changes-to-a-codespace)”和“[根据模板创建 codespace](/codespaces/developing-in-codespaces/creating-a-codespace-from-a-template#publishing-to-a-remote-repository)”。
### devcontainer.json
The primary file in a dev container configuration is the `devcontainer.json` file. You can use this file to determine the environment of codespaces created for your repository. The contents of this file define a dev container that can include frameworks, tools, extensions, and port forwarding. The `devcontainer.json` file usually contains a reference to a Dockerfile, which is typically located alongside the `devcontainer.json` file.
开发容器配置中的主文件是 `devcontainer.json` 文件。 可以使用此文件来确定为存储库创建的 codespace 环境。 此文件的内容定义了开发容器,它可以包括框架、工具、扩展和端口转发。 `devcontainer.json` 文件通常包含对 Dockerfile 的引用Dockerfile 通常与 `devcontainer.json` 文件放在一起。
If you create a codespace from a repository without a `devcontainer.json` file, or if you start from {% data variables.product.company_short %}'s blank template, the default dev container configuration is used. For more information, see "[Using the default dev container configuration](#using-the-default-dev-container-configuration)."
如果从没有 `devcontainer.json` 文件的存储库创建 codespace或者根据 {% data variables.product.company_short %} 的空白模板创建,则使用默认的开发容器配置。 有关详细信息,请参阅“[使用默认开发容器配置](#using-the-default-dev-container-configuration)”。
The `devcontainer.json` file is usually located in the `.devcontainer` directory of your repository. Alternatively, you can locate it directly in the root of the repository, in which case the file name must begin with a period: `.devcontainer.json`.
`devcontainer.json` 文件通常位于存储库的 `.devcontainer` 目录中。 或者,可以直接在存储库的根目录中找到它,在这种情况下,文件名必须以句点开头:`.devcontainer.json`
If you want to have a choice of dev container configurations in your repository, any alternatives to the `.devcontainer/devcontainer.json` (or `.devcontainer.json`) file must be located in their own subdirectory at the path `.devcontainer/SUBDIRECTORY/devcontainer.json`. For example, you could have a choice of two configurations:
如果要在存储库中选择开发容器配置,则 `.devcontainer/devcontainer.json`(或 `.devcontainer.json`)文件的任何替代文件都必须位于路径 `.devcontainer/SUBDIRECTORY/devcontainer.json` 处它们自己的子目录中。 例如,可以选择两种配置:
* `.devcontainer/database-dev/devcontainer.json`
* `.devcontainer/gui-dev/devcontainer.json`
When you have multiple `devcontainer.json` files in your repository, each codespace is created from only one of the configurations. Settings cannot be imported or inherited between `devcontainer.json` files. If a `devcontainer.json` file in a custom subdirectory has dependent files, such as the Dockerfile or scripts that are run by commands in the `devcontainer.json` file, it's recommended that you co-locate these files in the same subdirectory.
当存储库中有多个 `devcontainer.json` 文件时,每个 codespace 仅从其中一种配置创建。 无法在 `devcontainer.json` 文件之间导入或继承设置。 如果自定义子目录中的 `devcontainer.json` 文件具有依赖文件(例如 Dockerfile 或由 `devcontainer.json` 文件中的命令运行的脚本),建议将这些文件放在同一子目录中。
For information about how to choose your preferred dev container configuration when you create a codespace, see "[Creating a codespace for a repository](/codespaces/developing-in-codespaces/creating-a-codespace-for-a-repository#creating-a-codespace-for-a-repository)."
有关如何在创建 codespace 时选择首选的开发容器配置的信息,请参阅“[为存储库创建 codespace](/codespaces/developing-in-codespaces/creating-a-codespace-for-a-repository#creating-a-codespace-for-a-repository)”。
{% data reusables.codespaces.more-info-devcontainer %}
#### How to use the devcontainer.json
#### 如何使用 devcontainer.json
It's useful to think of the `devcontainer.json` file as providing "customization" rather than "personalization." You should only include things that everyone working on your codebase needs as standard elements of the development environment, not things that are personal preferences. Things like linters are good to standardize on, and to require everyone to have installed, so they're good to include in your `devcontainer.json` file. Things like user interface decorators or themes are personal choices that should not be put in the `devcontainer.json` file.
`devcontainer.json` 文件视为提供“自定义”而不是“个性化”很有用。 你应仅包括每个人处理代码库都需要的内容(而不是个人偏好的内容),将它们作为开发环境的标准元素。 Linter 等内容非常适合标准化,并且要求每个人都安装,因此它们很适合包含在 `devcontainer.json` 文件中。 用户界面装饰器或主题等内容属于个人选择,不应放入 `devcontainer.json` 文件中。
You can personalize your codespaces by using dotfiles and Settings Sync. For more information, see "[Personalizing {% data variables.product.prodname_github_codespaces %} for your account](/codespaces/customizing-your-codespace/personalizing-github-codespaces-for-your-account)."
可以使用点文件和设置同步对 codespace 进行个性化设置。有关详细信息,请参阅“[为帐户设置个性化的 {% data variables.product.prodname_github_codespaces %}](/codespaces/customizing-your-codespace/personalizing-github-codespaces-for-your-account)”。
### Dockerfile
You can add a Dockerfile as part of your dev container configuration.
可以将 Dockerfile 添加为开发容器配置的一部分。
The Dockerfile is a text file that contains the instructions needed to create a Docker container image. This image is used to generate a development container each time someone creates a codespace using the `devcontainer.json` file that references this Dockerfile. The instructions in the Dockerfile typically begin by referencing a parent image on which the new image that will be created is based. This is followed by commands that are run during the image creation process, for example to install software packages.
Dockerfile 是一个文本文件,其中包含创建 Docker 容器映像所需的指令。 每次有人使用引用此 Dockerfile 的 `devcontainer.json` 文件创建 codespace 时,此映像用于生成开发容器。 Dockerfile 中的指令通常以引用将创建的新映像所基于的父映像开始。 随后是在映像创建过程中运行的命令,例如安装软件包。
The Dockerfile for a dev container is typically located in the `.devcontainer` folder, alongside the `devcontainer.json` in which it is referenced.
开发容器的 Dockerfile 通常位于 `.devcontainer` 文件夹中,引用它的 `devcontainer.json` 也在其中。
{% note %}
**Note**: As an alternative to using a Dockerfile you can use the `image` property in the `devcontainer.json` file to refer directly to an existing image you want to use. The image you specify here must be allowed by any organization image policy that has been set. For more information, see "[Restricting the base image for codespaces](/codespaces/managing-codespaces-for-your-organization/restricting-the-base-image-for-codespaces)." If neither a Dockerfile nor an image is found then the default container image is used. For more information, see "[Using the default dev container configuration](#using-the-default-dev-container-configuration)."
注意:作为使用 Dockerfile 的替代方法,可以使用 `devcontainer.json` 文件中的 `image` 属性直接引用要使用的现有映像。 已设置的任何组织映像策略都必须允许在此处指定的映像。 有关详细信息,请参阅“[限制 codespace 的基础映像](/codespaces/managing-codespaces-for-your-organization/restricting-the-base-image-for-codespaces)”。 如果找不到 Dockerfile 和映像,则使用默认容器映像。 有关详细信息,请参阅“[使用默认开发容器配置](#using-the-default-dev-container-configuration)”。
{% endnote %}
#### Simple Dockerfile example
#### 简单的 Dockerfile 示例
The following example uses four instructions:
以下示例使用四个指令:
`ARG` defines a build-time variable.
`ARG` 定义生成时变量。
`FROM` specifies the parent image on which the generated Docker image will be based.
`FROM` 指定生成的 Docker 映像所基于的父映像。
`COPY` copies a file and adds it to the filesystem.
`COPY` 复制文件并将其添加到文件系统。
`RUN` updates package lists and runs a script. You can also use a `RUN` instruction to install software, as shown by the commented out instructions. To run multiple commands, use `&&` to combine the commands into a single `RUN` statement.
`RUN` 更新包列表并运行脚本。 还可以使用 `RUN` 指令来安装软件,如注释掉的说明所示。 若要运行多个命令,请使用 `&&` 将命令组合成一个 `RUN` 语句。
```Dockerfile{:copy}
ARG VARIANT="16-buster"
@@ -97,11 +102,11 @@ COPY library-scripts/github-debian.sh /tmp/library-scripts/
RUN apt-get update && bash /tmp/library-scripts/github-debian.sh
```
For more information about Dockerfile instructions, see "[Dockerfile reference](https://docs.docker.com/engine/reference/builder)" in the Docker documentation.
有关 Dockerfile 指令的详细信息,请参阅 Docker 文档中的“[Dockerfile 参考](https://docs.docker.com/engine/reference/builder)”。
#### Using a Dockerfile
#### 使用 Dockerfile
To use a Dockerfile as part of a dev container configuration, reference it in your `devcontainer.json` file by using the `dockerfile` property.
若要将 Dockerfile 用作开发容器配置的一部分,请使用 `dockerfile` 属性在 `devcontainer.json` 文件中引用它。
```json{:copy}
{
@@ -111,130 +116,130 @@ To use a Dockerfile as part of a dev container configuration, reference it in yo
}
```
Various options are available to you if you want to use existing container orchestration in your dev container. For more information, see the "Orchestration options" section of the [Specification](https://containers.dev/implementors/spec/#orchestration-options) on the Development Containers website.
如果要在开发容器中使用现有容器业务流程,可以使用多种选项。 有关详细信息,请参阅开发容器网站上[规范](https://containers.dev/implementors/spec/#orchestration-options)中的“业务流程选项”部分。
## Using the default dev container configuration
## 使用默认开发容器配置
If you don't define a configuration in your repository, {% data variables.product.prodname_dotcom %} creates a codespace using a default Linux image. This Linux image includes a number of runtime versions for popular languages like Python, Node, PHP, Java, Go, C++, Ruby, and .NET Core/C#. The latest or LTS releases of these languages are used. There are also tools to support data science and machine learning, such as JupyterLab and Conda. The image also includes other developer tools and utilities like Git, GitHub CLI, yarn, openssh, and vim. To see all the languages, runtimes, and tools that are included use the `devcontainer-info content-url` command inside your codespace terminal and follow the URL that the command outputs.
如果没有在存储库中定义配置,{% data variables.product.prodname_dotcom %} 使用默认 Linux 映像创建 codespace。 此 Linux 映像包括许多常用语言的运行时版本,例如 PythonNodePHPJava、Go、C++Ruby .NET Core/C#。 使用这些语言的最新或 LTS 版本。 还有一些工具可以支持数据科学和机器学习,例如 JupyterLab Conda。 该映像还包括其他开发人员工具和实用程序,例如 GitGitHub CLIyarnopenssh 和 vim。 若要查看包含的所有语言、运行时和工具,请在 codespace 终端中使用 `devcontainer-info content-url` 命令,并遵循命令输出的 URL。
For information about what's included in the default Linux image, see the [`devcontainers/images`](https://github.com/devcontainers/images/tree/main/src/universal) repository.
有关默认 Linux 映像中包含内容的信息,请参阅 [`devcontainers/images`](https://github.com/devcontainers/images/tree/main/src/universal) 存储库。
The default configuration is a good option if you're working on a small project that uses the languages and tools that {% data variables.product.prodname_github_codespaces %} provides.
如果要处理使用 {% data variables.product.prodname_github_codespaces %} 提供的语言和工具的小型项目,默认配置是个不错的选择。
## Using a predefined dev container configuration
## 使用预定义的开发容器配置
If you use {% data variables.product.prodname_codespaces %} in {% data variables.product.prodname_vscode %}, or in a web browser, you can create a dev container configuration for your repository by choosing from a list of predefined configurations. These configurations provide common setups for particular project types, and can help you quickly get started with a configuration that already has the appropriate container options, {% data variables.product.prodname_vscode %} settings, and {% data variables.product.prodname_vscode %} extensions that should be installed.
如果在 {% data variables.product.prodname_vscode %} 或 Web 浏览器中使用 {% data variables.product.prodname_codespaces %},可以通过从预定义配置列表中进行选择,为存储库创建开发容器配置。 这些配置提供特定项目类型的共同设置,可帮助你快速开始使用已经有适当的容器选项、{% data variables.product.prodname_vscode %} 设置和应该安装的 {% data variables.product.prodname_vscode %} 扩展的配置。
Using a predefined configuration is a great idea if you need some additional extensibility. You can also start with a predefined configuration and amend it as needed for your project. For more information about the definitions of predefined dev containers, see the [`devcontainers/images`](https://github.com/devcontainers/images/tree/main/src) repository.
如果您需要一些额外的扩展性,使用预先定义的配置是一个好主意。 也可以从预定义的配置开始,并根据项目的需要对其进行修改。 有关预定义开发容器定义的详细信息,请参阅 [`devcontainers/images`](https://github.com/devcontainers/images/tree/main/src) 存储库。
You can add a predefined dev container configuration either while working in a codespace, or while working on a repository locally. To do this in {% data variables.product.prodname_vscode_shortname %} while you are working locally, and not connected to a codespace, you must have the "Dev Containers" extension installed and enabled. For more information about this extension, see the [{% data variables.product.prodname_vs_marketplace_shortname %}](https://marketplace.visualstudio.com/items?itemName=ms-vscode-remote.remote-containers). The following procedure describes the process when you are using a codespace. The steps in {% data variables.product.prodname_vscode_shortname %} when you are not connected to a codespace are very similar.
可以在 codespace 中工作时或在本地处理存储库时添加预定义的开发容器配置。 若要在本地工作且未连接到 codespace 时在 {% data variables.product.prodname_vscode_shortname %} 中执行此操作,必须安装并启用“开发容器”扩展。 有关该扩展的详细信息,请参阅 [{% data variables.product.prodname_vs_marketplace_shortname %}](https://marketplace.visualstudio.com/items?itemName=ms-vscode-remote.remote-containers)。 以下步骤介绍使用 codespace 的过程。 未连接到 codespace 时 {% data variables.product.prodname_vscode_shortname %} 中的步骤非常相似。
{% data reusables.codespaces.command-palette-container %}
1. Click the definition you want to use.
1. 单击要使用的定义。
![Screenshot of a list of predefined container definitions](/assets/images/help/codespaces/predefined-container-definitions-list.png)
![预定义容器定义列表的屏幕截图](/assets/images/help/codespaces/predefined-container-definitions-list.png)
1. Follow the prompts to customize your definition. For more information on the options to customize your definition, see "[Adding additional features to your `devcontainer.json` file](#adding-additional-features-to-your-devcontainerjson-file)."
1. Click **OK**.
1. 按照提示自定义您的定义。 有关自定义定义的选项的详细信息,请参阅“[ `devcontainer.json` 文件添加其他功能](#adding-additional-features-to-your-devcontainerjson-file)”。
1. 单击" **确定**"。
![Screenshot of the OK button](/assets/images/help/codespaces/prebuilt-container-ok-button.png)
![“确定”按钮的屏幕截图](/assets/images/help/codespaces/prebuilt-container-ok-button.png)
1. If you are working in a codespace, apply your changes, by clicking **Rebuild now** in the message at the bottom right of the window. For more information about rebuilding your container, see "[Applying changes to your configuration](#applying-configuration-changes-to-a-codespace)."
1. 如果在 codespace 中工作,请应用更改,方法是单击窗口右下角的消息中的“立即重新生成”。 有关重新生成容器的详细信息,请参阅“[对配置应用更改](#applying-configuration-changes-to-a-codespace)”。
![Screenshot of a prompt to 'Rebuild now'](/assets/images/help/codespaces/rebuild-prompt.png)
![提示“立即重新生成”的屏幕截图](/assets/images/help/codespaces/rebuild-prompt.png)
### Adding additional features to your `devcontainer.json` file
### `devcontainer.json` 文件添加其他功能
{% data reusables.codespaces.about-features %} For more information, see "[Adding features to a `devcontainer.json` file](/codespaces/setting-up-your-project-for-codespaces/adding-features-to-a-devcontainer-file?tool=vscode)."
{% data reusables.codespaces.about-features %} 有关详细信息,请参阅“[ `devcontainer.json` 文件添加功能](/codespaces/setting-up-your-project-for-codespaces/adding-features-to-a-devcontainer-file?tool=vscode)”。
## Creating a custom dev container configuration
## 创建自定义开发容器配置
If none of the predefined configurations meets your needs, you can create a custom configuration by writing your own `devcontainer.json` file.
如果任何预定义配置都不符合你的需求,可以通过编写自己的 `devcontainer.json` 文件创建自定义配置。
* If you're adding a single `devcontainer.json` file that will be used by everyone who creates a codespace from your repository, create the file within a `.devcontainer` directory at the root of the repository.
* If you want to offer users a choice of configuration, you can create multiple custom `devcontainer.json` files, each located within a separate subdirectory of the `.devcontainer` directory.
* 如果要添加一个 `devcontainer.json` 文件,该文件将由从存储库创建 codespace 的每个人使用,请在存储库根目录的 `.devcontainer` 目录中创建该文件。
* 如果要为用户提供配置选择,可以创建多个自定义 `devcontainer.json` 文件,每个文件位于 `.devcontainer` 目录的单独子目录中。
{% note %}
**Notes**:
- You can't locate your `devcontainer.json` files in directories more than one level below `.devcontainer`. For example, a file at `.devcontainer/teamA/devcontainer.json` will work, but `.devcontainer/teamA/testing/devcontainer.json` will not.
- {% data reusables.codespaces.configuration-choice-templates %} For more information, see "[Setting up a template repository for {% data variables.product.prodname_github_codespaces %}](/codespaces/setting-up-your-project-for-codespaces/setting-up-a-template-repository-for-github-codespaces)."
**注释**
- 无法在比 `.devcontainer` 低一级的目录中找到 `devcontainer.json` 文件。 例如,位于 `.devcontainer/teamA/devcontainer.json` 的文件可以正常运行,但 `.devcontainer/teamA/testing/devcontainer.json` 不行。
- {% data reusables.codespaces.configuration-choice-templates %} 有关详细信息,请参阅“[设置 {% data variables.product.prodname_github_codespaces %} 的模板存储库](/codespaces/setting-up-your-project-for-codespaces/setting-up-a-template-repository-for-github-codespaces)”。
{% endnote %}
If multiple `devcontainer.json` files are found in the repository, they are listed in the codespace creation options page. For more information, see "[Creating a codespace for a repository](/codespaces/developing-in-codespaces/creating-a-codespace-for-a-repository#creating-a-codespace-for-a-repository)."
如果在存储库中找到多个 `devcontainer.json` 文件,则会在 codespace 创建选项页中列出这些文件。 有关详细信息,请参阅“[为存储库创建 codespace](/codespaces/developing-in-codespaces/creating-a-codespace-for-a-repository#creating-a-codespace-for-a-repository)”。
![Screenshot of a choice of configuration files](/assets/images/help/codespaces/configuration-file-choice.png)
![选择配置文件的屏幕截图](/assets/images/help/codespaces/configuration-file-choice.png)
### Adding a `devcontainer.json` file
### 添加 `devcontainer.json` 文件
If you don't already have a `devcontainer.json` file in your repository, you can quickly add one from {% data variables.product.prodname_dotcom_the_website %}.
1. Navigate to your repository and click the **{% octicon "code" aria-label="The code icon" %} Code** dropdown.
1. In the **Codespaces** tab, click the ellipsis (**...**), then select **Configure dev container**.
如果存储库中还没有 `devcontainer.json` 文件,可以从 {% data variables.product.prodname_dotcom_the_website %} 快速添加一个。
1. 导航到存储库,然后单击“{% octicon "code" aria-label="The code icon" %} 代码”下拉列表。
1. 在“Codespace”选项卡中单击省略号 (...),然后选择“配置开发容器” 。
![Screenshot of the Code dropdown, with "Configure dev container" highlighted](/assets/images/help/codespaces/configure-dev-container.png)
![“代码”下拉列表的屏幕截图,其中突出显示了“配置开发容器”](/assets/images/help/codespaces/configure-dev-container.png)
A new `.devcontainer/devcontainer.json` file will open in the editor. The file will contain some initial properties, including a `features` object to which you can add new tools, libraries, or runtimes. For more information, see "[Adding features to a `devcontainer.json` file](/codespaces/setting-up-your-project-for-codespaces/adding-features-to-a-devcontainer-file?tool=webui)."
编辑器中将打开一个新的 `.devcontainer/devcontainer.json` 文件。 该文件将包含一些初始属性,包括可以向其添加新工具、库或运行时的 `features` 对象。 有关详细信息,请参阅“[ `devcontainer.json` 文件添加功能](/codespaces/setting-up-your-project-for-codespaces/adding-features-to-a-devcontainer-file?tool=webui)”。
If your repository already contains one or more `devcontainer.json` files, then clicking **Configure dev container** will open the existing `devcontainer.json` file with the highest precedence according to the [specification](https://containers.dev/implementors/spec/#devcontainerjson) on containers.dev.
如果存储库已包含一个或多个 `devcontainer.json` 文件,则单击“配置开发容器”,会根据 containers.dev 上的[规范](https://containers.dev/implementors/spec/#devcontainerjson)以最高优先级打开现有 `devcontainer.json` 文件。
### Default configuration selection during codespace creation
### 创建 codespace 期间的默认配置选择
If `.devcontainer/devcontainer.json` or `.devcontainer.json` exists, it will be the default selection in the list of available configuration files when you create a codespace. If neither file exists, the default dev container configuration will be selected by default.
如果 `.devcontainer/devcontainer.json` `.devcontainer.json` 存在,则创建 codespace 时,它将是可用配置文件列表中的默认选择。 如果两个文件都不存在,则默认选择默认开发容器配置。
![Screenshot of the default configuration choice selected](/assets/images/help/codespaces/configuration-file-choice-default.png)
![所选默认配置选项的屏幕截图](/assets/images/help/codespaces/configuration-file-choice-default.png)
### Editing the devcontainer.json file
### 编辑 devcontainer.json 文件
You can add and edit the supported configuration keys in the `devcontainer.json` file to specify aspects of the codespace's environment, like which {% data variables.product.prodname_vscode_shortname %} extensions will be installed. {% data reusables.codespaces.more-info-devcontainer %}
可以在 `devcontainer.json` 文件中添加和编辑支持的配置键,以指定 codespace 环境的各个方面,例如将安装哪些 {% data variables.product.prodname_vscode_shortname %} 扩展。 {% data reusables.codespaces.more-info-devcontainer %}
The `devcontainer.json` file is written using the JSONC (JSON with comments) format. This allows you to include comments within the configuration file. For more information, see "[Editing JSON with {% data variables.product.prodname_vscode_shortname %}](https://code.visualstudio.com/docs/languages/json#_json-with-comments)" in the {% data variables.product.prodname_vscode_shortname %} documentation.
`devcontainer.json` 文件是使用 JSONC带注释的 JSON格式编写的。 这样,就可以在配置文件中包含注释。 有关详细信息,请参阅 {% data variables.product.prodname_vscode_shortname %} 文档中的“[使用 {% data variables.product.prodname_vscode_shortname %} 编辑 JSON](https://code.visualstudio.com/docs/languages/json#_json-with-comments)”。
{% note %}
**Note**: If you use a linter to validate the `devcontainer.json` file, make sure it is set to JSONC and not JSON or comments will be reported as errors.
注意:如果使用 Linter 验证 `devcontainer.json` 文件,请确保将其设置为 JSONC 而不是 JSON否则注释将被报告为错误。
{% endnote %}
### Interface settings for {% data variables.product.prodname_vscode_shortname %}
### {% data variables.product.prodname_vscode_shortname %} 的接口设置
You can configure the interface settings for {% data variables.product.prodname_vscode_shortname %}, with three scopes: Workspace, Remote [Codespaces], and User. You can view these scopes in the {% data variables.product.prodname_vscode_shortname %} Settings editor.
可以使用以下三个范围为 {% data variables.product.prodname_vscode_shortname %} 配置接口设置:工作区、远程 [Codespaces] 和用户。 可以在 {% data variables.product.prodname_vscode_shortname %}“设置”编辑器中查看这些范围。
![Screenshot showing the choice of scopes in the Settings editor](/assets/images/help/codespaces/scopes-for-vscode.png)
![显示“设置”编辑器中范围选择的屏幕截图](/assets/images/help/codespaces/scopes-for-vscode.png)
If a setting is defined in multiple scopes, Workspace settings take priority, then Remote [Codespaces], then User.
如果某个设置在多个范围内定义,则优先顺序依次为“工作区”设置、“远程 [Codespaces]”、“用户” 。
You can define default interface settings for {% data variables.product.prodname_vscode_shortname %} in two places.
可以在两个地方定义 {% data variables.product.prodname_vscode_shortname %} 的默认接口设置。
* Interface settings defined in the `.vscode/settings.json` file in your repository are applied as Workspace-scoped settings in the codespace.
* Interface settings defined in the `settings` key in the `devcontainer.json` file are applied as Remote [Codespaces]-scoped settings in the codespace.
* 在存储库的 `.vscode/settings.json` 文件中定义的接口设置在 codespace 中应用为工作区范围的设置。
* `devcontainer.json` 文件的 `settings` 键中定义的接口设置应用为 codespace 中远程 [Codespaces] 范围的设置。
## Applying configuration changes to a codespace
## 将配置更改应用于 codespace
Changes to a configuration will be applied the next time you create a codespace. However, if you're using a codespace in a web browser, in {% data variables.product.prodname_vscode_shortname %}, or in a JetBrains IDE, you can apply configuration changes to the current codespace by rebuilding the container.
对配置的更改将在下次创建 codespace 时应用。 但是,如果在 Web 浏览器、{% data variables.product.prodname_vscode_shortname %} JetBrains IDE 中使用 codespace则可以通过重新生成容器将配置更改应用于当前 codespace。
### Rebuilding the dev container in the {% data variables.product.prodname_vscode_shortname %} web client or desktop application
### {% data variables.product.prodname_vscode_shortname %} Web 客户端或桌面应用程序中重新生成开发容器
{% data reusables.codespaces.rebuild-command %}
1. {% data reusables.codespaces.recovery-mode %}
![Screenshot of the error message about recovery mode](/assets/images/help/codespaces/recovery-mode-error-message.png)
![有关恢复模式错误消息的屏幕截图](/assets/images/help/codespaces/recovery-mode-error-message.png)
- To diagnose the error by reviewing the creation logs, click **View creation log**.
- To fix the errors identified in the logs, update your `devcontainer.json` file.
- To apply the changes, rebuild your container.
- 若要通过查看创建日志来诊断错误,请单击“查看创建日志”。
- 若要修复日志中标识的错误,请更新 `devcontainer.json` 文件。
- 要应用更改,请重建容器。
### Rebuilding the dev container in a JetBrains IDE
### JetBrains IDE 中重新生成开发容器
{% data reusables.codespaces.jetbrains-open-codespace-plugin %}
1. In the {% data variables.product.prodname_github_codespaces %} tool window, click the rebuild icon.
1. {% data variables.product.prodname_github_codespaces %} 工具窗口中,单击“重新生成”图标。
![Screenshot of the rebuild button](/assets/images/help/codespaces/jetbrains-plugin-icon-rebuild.png)
![“重新生成”按钮的屏幕截图](/assets/images/help/codespaces/jetbrains-plugin-icon-rebuild.png)
1. Click **Rebuild** when prompted to confirm that you want to rebuild the dev container.
1. Reopen the codespace in your JetBrains IDE.
1. 当提示确认是否要重新生成开发容器时,单击“重新生成”。
1. 在 JetBrains IDE 中重新打开 codespace。
## Further reading
## 延伸阅读
- "[Prebuilding your codespaces](/codespaces/prebuilding-your-codespaces)"
- [预构建 codespaces](/codespaces/prebuilding-your-codespaces)

View File

@@ -1,7 +1,7 @@
---
title: Setting a minimum specification for codespace machines
title: 为代码空间计算机设置最低规范
shortTitle: Set a minimum machine spec
intro: 'You can avoid under-resourced machine types being used for {% data variables.product.prodname_github_codespaces %} for your repository.'
intro: '你可以避免资源不足的计算机类型用于存储库的 {% data variables.product.prodname_github_codespaces %}'
permissions: People with write permissions to a repository can create or edit the codespace configuration.
versions:
fpt: '*'
@@ -10,26 +10,31 @@ type: how_to
topics:
- Codespaces
- Set up
ms.openlocfilehash: b7eeaac84721ff1d9ceab663957b1615952b0623
ms.sourcegitcommit: e8c012864f13f9146e53fcb0699e2928c949ffa8
ms.translationtype: HT
ms.contentlocale: zh-CN
ms.lasthandoff: 11/09/2022
ms.locfileid: '148159163'
---
## 概述
## Overview
创建的每个 codespace 都托管在单独的虚拟机上。 从存储库创建 codespace 时,通常可以从不同类型的虚拟机中进行选择。 每个计算机类型都有不同的资源(处理器内核、内存、存储),默认情况下,使用资源最少的计算机类型。 有关详细信息,请参阅“[更改 codespace 的计算机类型](/codespaces/customizing-your-codespace/changing-the-machine-type-for-your-codespace#about-machine-types)”。
Each codespace that you create is hosted on a separate virtual machine. When you create a codespace from a repository, you can usually choose from different types of virtual machines. Each machine type has different resources (processor cores, memory, storage) and, by default, the machine type with the least resources is used. For more information, see "[Changing the machine type for your codespace](/codespaces/customizing-your-codespace/changing-the-machine-type-for-your-codespace#about-machine-types)."
If your project needs a certain level of compute power, you can configure {% data variables.product.prodname_github_codespaces %} so that only machine types that meet these requirements can be used by default, or selected by users. You configure this in a `devcontainer.json` file.
如果项目需要一定程度的计算能力,则可以配置 {% data variables.product.prodname_github_codespaces %} 以便默认情况下只能使用或由用户选择满足这些要求的计算机类型。 可以在 `devcontainer.json` 文件中进行此配置。
{% data reusables.codespaces.machine-types-for-unpublished-codespaces %}
{% note %}
**Important:** Access to some machine types may be restricted at the organization level. Typically this is done to prevent people choosing higher resourced machines that are billed at a higher rate. If your repository is affected by an organization-level policy for machine types you should make sure you don't set a minimum specification that would leave no available machine types for people to choose. For more information, see "[Restricting access to machine types](/codespaces/managing-codespaces-for-your-organization/restricting-access-to-machine-types)."
重要提示:对某些计算机类型的访问可能在组织级别受到限制。 通常,这样做是为了防止人们选择以较高费率计费的资源较高的计算机。 如果您的存储库受到组织级计算机类型策略的影响,则应确保不要设置最低规范,因为该规范不会留下任何可用的计算机类型供人们选择。 有关详细信息,请参阅“[限制对计算机类型的访问](/codespaces/managing-codespaces-for-your-organization/restricting-access-to-machine-types)”。
{% endnote %}
## Setting a minimum machine specification
## 设置最低计算机规范
{% data reusables.codespaces.edit-devcontainer-json %}
1. Edit the `devcontainer.json` file, adding the `hostRequirements` property at the top level of the file, within the enclosing JSON object. For example:
1. 编辑 `devcontainer.json` 文件,将属性 `hostRequirements` 添加到文件顶层,位于封闭的 JSON 对象内。 例如:
```json{:copy}
"hostRequirements": {
@@ -39,16 +44,16 @@ If your project needs a certain level of compute power, you can configure {% dat
}
```
You can specify any or all of the options: `cpus`, `memory`, and `storage`.
可以指定以下任何或所有选项:`cpus``memory` `storage`
To check the specifications of the {% data variables.product.prodname_github_codespaces %} machine types that are currently available for your repository, step through the process of creating a codespace until you see the choice of machine types. For more information, see "[Creating a codespace for a repository](/codespaces/developing-in-codespaces/creating-a-codespace-for-a-repository#creating-a-codespace-for-a-repository)."
要检查当前可用于存储库的 {% data variables.product.prodname_github_codespaces %} 计算机类型的规范,请逐步完成创建 codespace 的过程,直到看到选择的计算机类型。 有关详细信息,请参阅“[为存储库创建 codespace](/codespaces/developing-in-codespaces/creating-a-codespace-for-a-repository#creating-a-codespace-for-a-repository)”。
1. Save the file and commit your changes to the required branch of the repository.
1. 保存文件并将更改提交到存储库的所需分支。
Now when you create a codespace for that branch of the repository, and you go to the creation configuration options, you will only be able to select machine types that match or exceed the resources you've specified.
现在,当你为存储库的该分支创建代码空间时,前往创建配置选项,只能选择与指定资源匹配或超过你指定的资源的计算机类型。
![Dialog box showing a limited choice of machine types](/assets/images/help/codespaces/machine-types-limited-choice.png)
![显示有限计算机类型选择的对话框](/assets/images/help/codespaces/machine-types-limited-choice.png)
## Further reading
## 延伸阅读
- "[Introduction to dev containers](/codespaces/setting-up-your-project-for-codespaces/introduction-to-dev-containers)"
- [开发容器简介](/codespaces/setting-up-your-project-for-codespaces/introduction-to-dev-containers)

View File

@@ -0,0 +1,88 @@
---
title: 为 GitHub Codespaces 设置模板存储库
shortTitle: Set up a template repo
intro: '可以通过为 {% data variables.product.prodname_github_codespaces %} 设置模板存储库,帮助用户开始使用项目。'
versions:
fpt: '*'
ghec: '*'
type: how_to
topics:
- Codespaces
- Set up
ms.openlocfilehash: 155aa9bf839301439d2746b4b6f0f0575d2e60ff
ms.sourcegitcommit: e8c012864f13f9146e53fcb0699e2928c949ffa8
ms.translationtype: HT
ms.contentlocale: zh-CN
ms.lasthandoff: 11/09/2022
ms.locfileid: '148159438'
---
## 简介
通过设置模板存储库,可以帮助用户开始使用你的框架、库或 {% data variables.product.prodname_github_codespaces %} 中的其他项目。 用户将能够立即在基于云的开发环境中开始使用模板文件,而无需担心克隆存储库或安装工具或其他依赖项。 通过某些配置,你能够在 codespace 中设置用户,其中重要文件已打开以供编辑,并且应用程序已在 {% data variables.product.prodname_vscode_shortname %} Web 编辑器中的预览浏览器选项卡中运行。
具有模板存储库读取访问权限的任何人都可以从 {% data variables.product.product_name %} 上的存储库页面创建 codespace。 可以将任何现有存储库转换为模板,无需更改任何设置即可支持用户从模板存储库创建 codespace。 有关将存储库转换为模板的详细信息,请参阅“[创建模板存储库](/repositories/creating-and-managing-repositories/creating-a-template-repository)”。
可以提供格式为 `https://github.com/codespaces/new?template_repository=OWNER/TEMPLATE-REPO` 的链接,使用户直接转到模板的“创建新 codespace”页面。
![“创建新 codespace”页的屏幕截图](/assets/images/help/codespaces/create-a-new-codespace-page.png)
例如,可以在关于开始使用你的框架的教程中提供此链接。 在链接中,将 `OWNER/TEMPLATE-REPO` 替换为模板存储库的名称,例如 `monalisa/octo-template`
当某人从你的模板创建 codespace 时,你的模板存储库的内容将克隆到其 codespace 中。 用户准备就绪后,他们可以将工作发布到属于其个人帐户的 {% data variables.product.product_name %} 上的新存储库。 codespace 的任何使用费都将由创建 codespace 的用户支付。 有关详细信息,请参阅“[从模板创建 codespace](/codespaces/developing-in-codespaces/creating-a-codespace-from-a-template)”。
## 描述模板
如果没有模板,请为模板存储库创建自述文件,以描述模板的用途以及如何开始使用它。 有关详细信息,请参阅“[关于 README](/repositories/managing-your-repositorys-settings-and-features/customizing-your-repository/about-readmes)”。
模板的简短描述会显示在用户通过 `https://github.com/codespaces/new?template_repository=OWNER/TEMPLATE-REPO` 链接登陆的“创建新 codespace”页面上。 此说明来自创建存储库时可以设置的“说明”字段。 可以随时编辑此说明,方法是导航到存储库的页面,然后单击页面右侧“关于”部分旁边的“{% octicon "gear" aria-label="The Settings gear" %}”。
![存储库页上“关于”部分的屏幕截图](/assets/images/help/repository/repository-settings-icon.png)
## 添加初学者文件
模板存储库通常包含具有样板代码的初学者文件,以便用户可以快速开始使用库、框架或其他技术。
有关要包含的文件类型的指导,可以查看 {% data variables.product.prodname_github_codespaces %} 的官方 {% data variables.product.company_short %} 模板中包含的初学者文件,如下所示。
{% data reusables.codespaces.your-codespaces-procedure-step %} {% data reusables.codespaces.view-all-templates-step %}
1. 若要查看包含模板文件的模板存储库,请单击模板的名称。
![“探索快速入门模板”部分的屏幕截图其中突出显示了“React”](/assets/images/help/codespaces/react-template-name.png)
## 配置容器映像
可以将开发容器配置文件添加到模板存储库,以便为将模板用于 {% data variables.product.prodname_github_codespaces %} 的用户自定义开发环境。 可以从 {% data variables.product.prodname_vscode %} 中的预定义配置设置列表中进行选择,也可以通过编写自己的 `devcontainer.json` 文件创建自定义配置。 如果不添加配置文件,将使用默认容器映像。 有关详细信息,请参阅“[开发容器简介](/codespaces/setting-up-your-project-for-codespaces/introduction-to-dev-containers)”和“[将开发容器配置添加到存储库](/codespaces/setting-up-your-project-for-codespaces/setting-up-your-project-for-codespaces)”。
{% note %}
注意:{% data reusables.codespaces.configuration-choice-templates %}
{% endnote %}
应使用工具和自定义项配置开发容器,为用户提供模板的最佳体验。 例如,在 `devcontainer.json` 文件中:
- 从模板创建 codespace 时,可以使用 `openFiles` 属性,定义要在 {% data variables.product.prodname_vscode_shortname %} Web 客户端中自动打开的文件列表。
- 如果模板包含 Web 应用程序的文件,则可以使应用程序在用户的 codespace 中自动运行。 为此,可以使用 `postAttachCommand` 属性运行脚本,该脚本在 {% data variables.product.prodname_vscode_shortname %} Web 客户端连接到 codespace 后立即在本地服务器上启动应用程序,并将端口的 `onAutoForward` 属性设置为 `openPreview`,以便在嵌入 {% data variables.product.prodname_vscode_shortname %} Web 客户端的简单浏览器中显示在该端口上运行的应用程序。
React 模板的以下配置设置将在用户的编辑器中打开 `app.js` 文件,运行(在 `package.json` 文件中定义的)`npm start` 来启动本地服务器,并将端口 `3000` 转发到 codespace 中的预览浏览器选项卡。
```JSON
{
"postAttachCommand": {
"server": "npm start",
},
"portsAttributes": {
"3000": {
"label": "Application",
"onAutoForward": "openPreview"
}
},
"customizations": {
"codespaces": {
"openFiles": ["src/App.js"]
}
}
}
```
有关详细信息,请参阅“[在存储库的 codespaces 中自动打开文件](/codespaces/setting-up-your-project-for-codespaces/automatically-opening-files-in-the-codespaces-for-a-repository)”和 containers.dev [上的开发容器规范](https://containers.dev/implementors/json_reference/#general-properties)。

View File

@@ -1,8 +1,8 @@
---
title: Setting up your C# (.NET) project for GitHub Codespaces
title: GitHub Codespaces 设置 C# (.NET) 项目
shortTitle: Setting up your C# (.NET) project
allowTitleToDifferFromFilename: true
intro: 'Get started with your C# (.NET) project in {% data variables.product.prodname_github_codespaces %} by creating a custom dev container.'
intro: '通过创建自定义开发容器,开始在 {% data variables.product.prodname_github_codespaces %} 中使用 C# (.NET) 项目。'
redirect_from:
- /codespaces/getting-started-with-codespaces/getting-started-with-your-dotnet-project
versions:
@@ -12,122 +12,126 @@ topics:
- Codespaces
hasExperimentalAlternative: true
hidden: true
ms.openlocfilehash: 10282aedf3bdb239fa238e546c2fc6280787a6a0
ms.sourcegitcommit: e8c012864f13f9146e53fcb0699e2928c949ffa8
ms.translationtype: HT
ms.contentlocale: zh-CN
ms.lasthandoff: 11/09/2022
ms.locfileid: '148158611'
---
## 简介
## Introduction
本指南介绍如何设置 C# (.NET) 项目 {% data reusables.codespaces.setting-up-project-intro %}
This guide shows you how to set up your C# (.NET) project {% data reusables.codespaces.setting-up-project-intro %}
### 先决条件
### Prerequisites
- 您应该在 {% data variables.product.prodname_dotcom_the_website %} 的仓库中有现有的 C# (.NET) 项目。 如果没有项目,可以使用以下示例尝试本教程: https://github.com/2percentsilk/dotnet-quickstart 。
- 必须为组织启用 {% data variables.product.prodname_github_codespaces %}。
- You should have an existing C# (.NET) project in a repository on {% data variables.product.prodname_dotcom_the_website %}. If you don't have a project, you can try this tutorial with the following example: https://github.com/2percentsilk/dotnet-quickstart.
- You must have {% data variables.product.prodname_github_codespaces %} enabled for your organization.
## 步骤 1在代码空间中打开项目
## Step 1: Open your project in a codespace
1. 在存储库名称下,使用“{% octicon "code" aria-label="The code icon" %} 代码”下拉菜单然后在“Codespaces”选项卡中单击加号 ({% octicon "plus" aria-label="The plus icon" %}) 。
1. Under the repository name, use the **{% octicon "code" aria-label="The code icon" %} Code** dropdown menu, and in the **Codespaces** tab, click the plus sign ({% octicon "plus" aria-label="The plus icon" %}).
![新建代码空间按钮](/assets/images/help/codespaces/new-codespace-button.png)
![New codespace button](/assets/images/help/codespaces/new-codespace-button.png)
When you create a codespace, your project is created on a remote VM that is dedicated to you. By default, the container for your codespace has many languages and runtimes including .NET. It also includes a common set of tools like git, wget, rsync, openssh, and nano.
创建代码空间时,您的项目是在专用于您的远程 VM 上创建的。 默认情况下,代码空间的容器具有多种语言和运行时,包括 .NET。 它还包括一套常见的工具,例如 git、wget、rsync、openssh 和 nano。
{% data reusables.codespaces.customize-vcpus-and-ram %}
## Step 2: Add a dev container configuration to your repository from a template
## 步骤 2从模板将开发容器配置添加到存储库
The default development container, or "dev container," for {% data variables.product.prodname_github_codespaces %} comes with the latest .NET version and common tools preinstalled. However, we recommend that you configure your own dev container to include all of the tools and scripts that your project needs. This will ensure a fully reproducible environment for all {% data variables.product.prodname_github_codespaces %} users in your repository.
{% data variables.product.prodname_github_codespaces %} 的默认开发容器或“开发容器”预先安装了最新的 .NET 版本和常用工具。 但是,我们建议配置自己的开发容器,以包含项目所需的所有工具和脚本。 这将确保存储库中的所有 {% data variables.product.prodname_github_codespaces %} 用户都拥有完全可复制的环境。
{% data reusables.codespaces.setup-custom-devcontainer %}
{% data reusables.codespaces.command-palette-container %}
1. For this example, click **C# (.NET)**. If you need additional features you can select any container thats specific to C# (.NET) or a combination of tools such as C# (.NET) and MS SQL.
![Select C# (.NET) option from the list](/assets/images/help/codespaces/add-dotnet-prebuilt-container.png)
1. Click the recommended version of .NET.
![.NET version selection](/assets/images/help/codespaces/add-dotnet-version.png)
1. Accept the default option to add Node.js to your customization.
![Add Node.js selection](/assets/images/help/codespaces/dotnet-options.png)
{% data reusables.codespaces.rebuild-command %}
1. 在本示例中请单击“C# (.NET)”。 如果需要其他功能,您可以选择任何特定于 C# (.NET) 或工具(如 C# (.NET) MS SQL)组合的容器。
![从列表中选择 C# (.NET) 选项](/assets/images/help/codespaces/add-dotnet-prebuilt-container.png)
1. 单击推荐的 .NET 版本。
![.NET 版本选择](/assets/images/help/codespaces/add-dotnet-version.png)
1. 接受默认选项,将 Node.js 添加到您的自定义中。
![添加 Node.js 选择](/assets/images/help/codespaces/dotnet-options.png) {% data reusables.codespaces.rebuild-command %}
### Anatomy of your dev container
### 开发容器的剖析
Adding the C# (.NET) dev container template adds a `.devcontainer` folder to the root of your project's repository with the following files:
添加 C# (.NET) 开发容器模板会将 `.devcontainer` 文件夹添加到项目存储库的根目录中,其中包含以下文件:
- `devcontainer.json`
- Dockerfile
The newly added `devcontainer.json` file defines a few properties that are described after the sample.
新添加的 `devcontainer.json` 文件定义了在示例之后描述的几个属性。
#### devcontainer.json
```json
{
"name": "C# (.NET)",
"build": {
"dockerfile": "Dockerfile",
"args": {
// Update 'VARIANT' to pick a .NET Core version: 2.1, 3.1, 5.0
"VARIANT": "5.0",
// Options
"INSTALL_NODE": "true",
"NODE_VERSION": "lts/*",
"INSTALL_AZURE_CLI": "false"
}
},
"name": "C# (.NET)",
"build": {
"dockerfile": "Dockerfile",
"args": {
// Update 'VARIANT' to pick a .NET Core version: 2.1, 3.1, 5.0
"VARIANT": "5.0",
// Options
"INSTALL_NODE": "true",
"NODE_VERSION": "lts/*",
"INSTALL_AZURE_CLI": "false"
}
},
// Set *default* container specific settings.json values on container create.
"settings": {
"terminal.integrated.shell.linux": "/bin/bash"
},
// Set *default* container specific settings.json values on container create.
"settings": {
"terminal.integrated.shell.linux": "/bin/bash"
},
// Add the IDs of extensions you want installed when the container is created.
"extensions": [
"ms-dotnettools.csharp"
],
// Add the IDs of extensions you want installed when the container is created.
"extensions": [
"ms-dotnettools.csharp"
],
// Use 'forwardPorts' to make a list of ports inside the container available locally.
// "forwardPorts": [5000, 5001],
// Use 'forwardPorts' to make a list of ports inside the container available locally.
// "forwardPorts": [5000, 5001],
// [Optional] To reuse of your local HTTPS dev cert:
//
// 1. Export it locally using this command:
// * Windows PowerShell:
// dotnet dev-certs https --trust; dotnet dev-certs https -ep "$env:USERPROFILE/.aspnet/https/aspnetapp.pfx" -p "SecurePwdGoesHere"
// * macOS/Linux terminal:
// dotnet dev-certs https --trust; dotnet dev-certs https -ep "${HOME}/.aspnet/https/aspnetapp.pfx" -p "SecurePwdGoesHere"
//
// 2. Uncomment these 'remoteEnv' lines:
// "remoteEnv": {
// "ASPNETCORE_Kestrel__Certificates__Default__Password": "SecurePwdGoesHere",
// "ASPNETCORE_Kestrel__Certificates__Default__Path": "/home/vscode/.aspnet/https/aspnetapp.pfx",
// },
//
// 3. Start the container.
//
// 4. Drag ~/.aspnet/https/aspnetapp.pfx into the root of the file explorer.
//
// 5. Open a terminal in VS Code and run "mkdir -p /home/vscode/.aspnet/https && mv aspnetapp.pfx /home/vscode/.aspnet/https".
//
// [Optional] To reuse of your local HTTPS dev cert:
//
// 1. Export it locally using this command:
// * Windows PowerShell:
// dotnet dev-certs https --trust; dotnet dev-certs https -ep "$env:USERPROFILE/.aspnet/https/aspnetapp.pfx" -p "SecurePwdGoesHere"
// * macOS/Linux terminal:
// dotnet dev-certs https --trust; dotnet dev-certs https -ep "${HOME}/.aspnet/https/aspnetapp.pfx" -p "SecurePwdGoesHere"
//
// 2. Uncomment these 'remoteEnv' lines:
// "remoteEnv": {
// "ASPNETCORE_Kestrel__Certificates__Default__Password": "SecurePwdGoesHere",
// "ASPNETCORE_Kestrel__Certificates__Default__Path": "/home/vscode/.aspnet/https/aspnetapp.pfx",
// },
//
// 3. Start the container.
//
// 4. Drag ~/.aspnet/https/aspnetapp.pfx into the root of the file explorer.
//
// 5. Open a terminal in VS Code and run "mkdir -p /home/vscode/.aspnet/https && mv aspnetapp.pfx /home/vscode/.aspnet/https".
//
// Use 'postCreateCommand' to run commands after the container is created.
// "postCreateCommand": "dotnet restore",
// Use 'postCreateCommand' to run commands after the container is created.
// "postCreateCommand": "dotnet restore",
// Comment out connect as root instead. More info: https://aka.ms/vscode-remote/containers/non-root.
"remoteUser": "vscode"
// Comment out connect as root instead. More info: https://aka.ms/vscode-remote/containers/non-root.
"remoteUser": "vscode"
}
```
- **name** - You can name our dev container anything, this is just the default.
- **build** - The build properties.
- **dockerfile** - In the `build` object, `dockerfile` contains the path to the Dockerfile that was also added from the template.
- name - 可以将开发容器命名为任何名称,这只是默认名称。
- build - 生成属性。
- dockerfile - 在 `build` 对象中,`dockerfile` 包含 Dockerfile 的路径,该文件也是从模板中添加的。
- **args**
- **variant**: This file only contains one build argument, which is the .NET Core version that we want to use.
- **settings** - These are {% data variables.product.prodname_vscode %} settings.
- **terminal.integrated.shell.linux** - While bash is the default here, you could use other terminal shells by modifying this.
- **extensions** - These are extensions included by default.
- **ms-dotnettools.csharp** - The Microsoft C# extension provides rich support for developing in C#, including features such as IntelliSense, linting, debugging, code navigation, code formatting, refactoring, variable explorer, test explorer, and more.
- **forwardPorts** - Any ports listed here will be forwarded automatically. For more information, see "[Forwarding ports in your codespace](/codespaces/developing-in-codespaces/forwarding-ports-in-your-codespace)."
- **postCreateCommand** - Use this to run commands that aren't defined in the Dockerfile, after your codespace is created.
- **remoteUser** - By default, youre running as the vscode user, but you can optionally set this to root.
- variant:此文件仅包含一个生成参数,即我们要使用的 .NET Core 版本。
- settings - 这些是 {% data variables.product.prodname_vscode %} 设置。
- terminal.integrated.shell.linux - 虽然 bash 是此处的默认设置,但你可以通过修改它来使用其他终端 shell。
- extensions - 这些是默认包含的扩展。
- **ms-dotnettools.csharp** - Microsoft C# 扩展为使用 C# 的开发提供丰富的支持,包括 IntelliSenselinting、调试、代码导航、代码格式化、重构、变量资源管理器、测试资源管理器等功能。
- **forwardPorts** - 此处列出的任何端口都将自动转发。 有关详细信息,请参阅“[ codespace 中转发端口](/codespaces/developing-in-codespaces/forwarding-ports-in-your-codespace)。”
- postCreateCommand - 使用此方法在创建 codespace 后,运行未在 Dockerfile 中定义的命令。
- **remoteUser** - 默认情况下以 vscode 用户身份运行,但可以选择将其设置为 root
#### Dockerfile
@@ -155,26 +159,26 @@ RUN if [ "$INSTALL_AZURE_CLI" = "true" ]; then bash /tmp/library-scripts/azcli-d
# RUN su vscode -c "source /usr/local/share/nvm/nvm.sh && npm install -g <your-package-here>" 2>&1
```
You can use the Dockerfile to add additional container layers to specify OS packages, node versions, or global packages we want included in our container.
您可以使用 Dockerfile 添加其他容器层,以指定要包含在容器中的操作系统包、节点版本或全局包。
## Step 3: Modify your devcontainer.json file
## 步骤 3修改 devcontainer.json 文件
With your dev container configuration added and a basic understanding of what everything does, you can now make changes to customize your environment further. In this example, you'll add properties to install extensions and your project dependencies when your codespace launches.
添加了开发容器配置并基本了解所有功能之后,现在可以进行更改以进一步自定义你的环境。 在此示例中,您将在代码空间启动时添加属性以安装扩展和项目依赖项。
1. In the Explorer, select the `devcontainer.json` file from the tree to open it. You might have to expand the `.devcontainer` folder to see it.
1. 在资源管理器中,从树中选择 `devcontainer.json` 文件以将其打开。 可能需要展开 `.devcontainer` 文件夹才能看到它。
![devcontainer.json file in the Explorer](/assets/images/help/codespaces/devcontainers-options.png)
![Explorer 中的 devcontainer.json 文件](/assets/images/help/codespaces/devcontainers-options.png)
2. Update your the `extensions` list in your `devcontainer.json` file to add a few extensions that are useful when working with your project.
2. 更新 `devcontainer.json` 文件中的 `extensions` 列表,以添加一些在处理项目时有用的扩展。
```json{:copy}
"extensions": [
"ms-dotnettools.csharp",
"streetsidesoftware.code-spell-checker",
],
"ms-dotnettools.csharp",
"streetsidesoftware.code-spell-checker",
],
```
3. Uncomment the `postCreateCommand` to restore dependencies as part of the codespace setup process.
3. 取消注释 `postCreateCommand` 以便在 codespace 设置过程中恢复依赖项。
```json{:copy}
// Use 'postCreateCommand' to run commands after the container is created.
@@ -187,26 +191,26 @@ With your dev container configuration added and a basic understanding of what ev
{% data reusables.codespaces.rebuild-reason %}
5. Check your changes were successfully applied by verifying the "Code Spell Checker" extension was installed.
5. 通过验证是否安装了 "Code Spell Checker" 扩展,检查更改是否成功应用。
![Extensions list](/assets/images/help/codespaces/dotnet-extensions.png)
![扩展列表](/assets/images/help/codespaces/dotnet-extensions.png)
## Step 4: Run your application
## 步骤 4运行应用程序
In the previous section, you used the `postCreateCommand` to install a set of packages via the `dotnet restore` command. With our dependencies now installed, we can run our application.
在上一部分中,你使用 `postCreateCommand` 通过 `dotnet restore` 命令安装了一组包。 现在安装了依赖项,我们可以运行应用程序。
1. Run your application by pressing `F5` or entering `dotnet watch run` in your terminal.
1. 通过按 `F5` 或在终端中输入 `dotnet watch run` 来运行应用程序。
2. When your project starts, you should see a "toast" notification message at the bottom right corner of {% data variables.product.prodname_vscode_shortname %}, containing a prompt to connect to the port your project uses.
2. 项目启动时,{% data variables.product.prodname_vscode_shortname %} 右下角应会显示一条“toast”通知消息其中包含连接到项目使用的端口的提示。
![Port forwarding "toast" notification](/assets/images/help/codespaces/python-port-forwarding.png)
![端口转发“toast”通知](/assets/images/help/codespaces/python-port-forwarding.png)
## Step 5: Commit your changes
## 步骤 5提交更改
{% data reusables.codespaces.committing-link-to-procedure %}
## Next steps
## 后续步骤
You should now be ready start developing your C# (.NET) project in {% data variables.product.prodname_github_codespaces %}. Here are some additional resources for more advanced scenarios.
现在,应已准备好开始在 {% data variables.product.prodname_github_codespaces %} 中开发 C# (.NET) 项目。 以下是用于更高级场景的一些额外资源。
{% data reusables.codespaces.next-steps-adding-devcontainer %}

View File

@@ -1,8 +1,8 @@
---
title: Setting up your Java project for GitHub Codespaces
title: GitHub Codespaces 设置 Java 项目
allowTitleToDifferFromFilename: true
shortTitle: Setting up with your Java project
intro: 'Get started with your Java project in {% data variables.product.prodname_github_codespaces %} by creating a custom dev container.'
intro: '通过创建自定义开发容器,在 {% data variables.product.prodname_github_codespaces %} 中开始使用 Java 项目。'
redirect_from:
- /codespaces/getting-started-with-codespaces/getting-started-with-your-java-project-in-codespaces
versions:
@@ -12,48 +12,52 @@ topics:
- Codespaces
hasExperimentalAlternative: true
hidden: true
ms.openlocfilehash: b861744483f61bc01e8069188c1ce6298411d57e
ms.sourcegitcommit: e8c012864f13f9146e53fcb0699e2928c949ffa8
ms.translationtype: HT
ms.contentlocale: zh-CN
ms.lasthandoff: 11/09/2022
ms.locfileid: '148158763'
---
## 简介
## Introduction
本指南介绍如何设置 Java 项目 {% data reusables.codespaces.setting-up-project-intro %}
This guide shows you how to set up your Java project {% data reusables.codespaces.setting-up-project-intro %}
### 先决条件
### Prerequisites
- 您应该在 {% data variables.product.prodname_dotcom_the_website %} 的仓库中有现有的 Java 项目。 如果没有项目,可以使用以下示例尝试本教程: https://github.com/microsoft/vscode-remote-try-java
- 必须为组织启用 {% data variables.product.prodname_github_codespaces %}。
- You should have an existing Java project in a repository on {% data variables.product.prodname_dotcom_the_website %}. If you don't have a project, you can try this tutorial with the following example: https://github.com/microsoft/vscode-remote-try-java
- You must have {% data variables.product.prodname_github_codespaces %} enabled for your organization.
## 步骤 1在代码空间中打开项目
## Step 1: Open your project in a codespace
1. 在存储库名称下,使用“{% octicon "code" aria-label="The code icon" %} 代码”下拉菜单然后在“Codespaces”选项卡中单击加号 ({% octicon "plus" aria-label="The plus icon" %}) 。
1. Under the repository name, use the **{% octicon "code" aria-label="The code icon" %} Code** dropdown menu, and in the **Codespaces** tab, click the plus sign ({% octicon "plus" aria-label="The plus icon" %}).
![新建代码空间按钮](/assets/images/help/codespaces/new-codespace-button.png)
![New codespace button](/assets/images/help/codespaces/new-codespace-button.png)
When you create a codespace, your project is created on a remote VM that is dedicated to you. By default, the container for your codespace has many languages and runtimes including Java, nvm, npm, and Yarn. It also includes a set of commonly used tools such as git, wget, rsync, openssh, and nano.
创建代码空间时,您的项目是在专用于您的远程 VM 上创建的。 默认情况下,代码空间的容器有许多语言和运行时,包括 Java、nvm、npm 和 Yarn。 它还包括一套常见的工具,例如 git、wget、rsync、openssh 和 nano。
{% data reusables.codespaces.customize-vcpus-and-ram %}
## Step 2: Add a dev container configuration to your repository from a template
## 步骤 2从模板将开发容器配置添加到存储库
The default development container, or "dev container," for {% data variables.product.prodname_github_codespaces %} comes with the latest Java version, package managers (Maven, Gradle), and other common tools preinstalled. However, we recommend that you configure your own dev container to include all of the tools and scripts that your project needs. This will ensure a fully reproducible environment for all {% data variables.product.prodname_github_codespaces %} users in your repository.
{% data variables.product.prodname_github_codespaces %} 的默认开发容器或“开发容器”预先安装了最新的 Java 版本、包管理器(MavenGradle)和其他常用工具。 但是,我们建议配置自己的开发容器,以包含项目所需的所有工具和脚本。 这将确保存储库中的所有 {% data variables.product.prodname_github_codespaces %} 用户都拥有完全可复制的环境。
{% data reusables.codespaces.setup-custom-devcontainer %}
{% data reusables.codespaces.command-palette-container %}
1. For this example, click **Java**. In practice, you could select any container thats specific to Java or a combination of tools such as Java and Azure Functions.
![Select Java option from the list](/assets/images/help/codespaces/add-java-prebuilt-container.png)
1. Click the recommended version of Java.
![Java version selection](/assets/images/help/codespaces/add-java-version.png)
{% data reusables.codespaces.rebuild-command %}
1. 对于本示例请单击“Java”。 实际上,您可以选择任何特定于 Java 的容器或 Java Azure 函数等工具的组合。
![从列表中选择 Java 选项](/assets/images/help/codespaces/add-java-prebuilt-container.png)
1. 单击推荐的 Java 版本。
![Java 版本选择](/assets/images/help/codespaces/add-java-version.png) {% data reusables.codespaces.rebuild-command %}
### Anatomy of your dev container
### 开发容器的剖析
Adding the Java dev container template adds a `.devcontainer` directory to the root of your project's repository with the following files:
添加 Java 开发容器模板会将 `.devcontainer` 目录添加到项目存储库的根目录中,其中包含以下文件:
- `devcontainer.json`
- Dockerfile
The newly added `devcontainer.json` file defines a few properties that are described after the sample.
新添加的 `devcontainer.json` 文件定义了在示例之后描述的几个属性。
#### devcontainer.json
@@ -61,55 +65,55 @@ The newly added `devcontainer.json` file defines a few properties that are descr
// For format details, see https://aka.ms/vscode-remote/devcontainer.json or this file's README at:
// https://github.com/microsoft/vscode-dev-containers/tree/v0.159.0/containers/java
{
"name": "Java",
"build": {
"dockerfile": "Dockerfile",
"args": {
// Update the VARIANT arg to pick a Java version: 11, 14
"VARIANT": "11",
// Options
"INSTALL_MAVEN": "true",
"INSTALL_GRADLE": "false",
"INSTALL_NODE": "false",
"NODE_VERSION": "lts/*"
}
},
"name": "Java",
"build": {
"dockerfile": "Dockerfile",
"args": {
// Update the VARIANT arg to pick a Java version: 11, 14
"VARIANT": "11",
// Options
"INSTALL_MAVEN": "true",
"INSTALL_GRADLE": "false",
"INSTALL_NODE": "false",
"NODE_VERSION": "lts/*"
}
},
// Set *default* container specific settings.json values on container create.
"settings": {
"terminal.integrated.shell.linux": "/bin/bash",
"java.home": "/docker-java-home",
"maven.executable.path": "/usr/local/sdkman/candidates/maven/current/bin/mvn"
},
// Set *default* container specific settings.json values on container create.
"settings": {
"terminal.integrated.shell.linux": "/bin/bash",
"java.home": "/docker-java-home",
"maven.executable.path": "/usr/local/sdkman/candidates/maven/current/bin/mvn"
},
// Add the IDs of extensions you want installed when the container is created.
"extensions": [
"vscjava.vscode-java-pack"
],
// Add the IDs of extensions you want installed when the container is created.
"extensions": [
"vscjava.vscode-java-pack"
],
// Use 'forwardPorts' to make a list of ports inside the container available locally.
// "forwardPorts": [],
// Use 'forwardPorts' to make a list of ports inside the container available locally.
// "forwardPorts": [],
// Use 'postCreateCommand' to run commands after the container is created.
// "postCreateCommand": "java -version",
// Use 'postCreateCommand' to run commands after the container is created.
// "postCreateCommand": "java -version",
// Uncomment to connect as a non-root user. See https://aka.ms/vscode-remote/containers/non-root.
"remoteUser": "vscode"
// Uncomment to connect as a non-root user. See https://aka.ms/vscode-remote/containers/non-root.
"remoteUser": "vscode"
}
```
- **name** - You can name your dev container anything, this is just the default.
- **build** - The build properties.
- **dockerfile** - In the `build` object, `dockerfile` contains the path to the Dockerfile that was also added from the template.
- name - 可以将开发容器命名为任何名称,这只是默认名称。
- build - 生成属性。
- dockerfile - 在 `build` 对象中,`dockerfile` 包含 Dockerfile 的路径,该文件也是从模板中添加的。
- **args**
- **variant**: This file only contains one build argument, which is the Java version that is passed into the Dockerfile.
- **settings** - These are {% data variables.product.prodname_vscode %} settings that you can set.
- **terminal.integrated.shell.linux** - While bash is the default here, you could use other terminal shells by modifying this.
- **extensions** - These are extensions included by default.
- **vscjava.vscode-java-pack** - The Java Extension Pack provides popular extensions for Java development to get you started.
- **forwardPorts** - Any ports listed here will be forwarded automatically. For more information, see "[Forwarding ports in your codespace](/codespaces/developing-in-codespaces/forwarding-ports-in-your-codespace)."
- **postCreateCommand** - Use this to run commands that aren't defined in the Dockerfile, after your codespace is created.
- **remoteUser** - By default, youre running as the `vscode` user, but you can optionally set this to `root`.
- variant:此文件仅包含一个生成参数,即传递到 Dockerfile 的 Java 版本。
- settings - 这些是你可以设置的 {% data variables.product.prodname_vscode %} 设置。
- terminal.integrated.shell.linux - 虽然 bash 是此处的默认设置,但你可以通过修改它来使用其他终端 shell。
- extensions - 这些是默认包含的扩展。
- vscjava.vscode-java-pack - Java 扩展包为 Java 开发提供了常用的扩展,以帮助你入门。
- **forwardPorts** - 此处列出的任何端口都将自动转发。 有关详细信息,请参阅“[ codespace 中转发端口](/codespaces/developing-in-codespaces/forwarding-ports-in-your-codespace)。”
- postCreateCommand - 使用此方法在创建 codespace 后,运行未在 Dockerfile 中定义的命令。
- **remoteUser** - 默认情况下以 `vscode` 用户身份运行,但可以选择将其设置为 `root`
#### Dockerfile
@@ -139,17 +143,17 @@ RUN if [ "${INSTALL_NODE}" = "true" ]; then su vscode -c "source /usr/local/shar
# RUN su vscode -c "source /usr/local/share/nvm/nvm.sh && npm install -g <your-package-here>" 2>&1
```
You can use the Dockerfile to add additional container layers to specify OS packages, Java versions, or global packages we want included in our container.
你可以使用 Dockerfile 添加其他容器层以指定要包含在容器中的操作系统包、Java 版本或全局包。
## Step 3: Modify your devcontainer.json file
## 步骤 3修改 devcontainer.json 文件
With your dev container configuration added and a basic understanding of what everything does, you can now make changes to customize your environment further. In this example, you'll add properties to install extensions and your project dependencies when your codespace launches.
添加了开发容器配置并基本了解所有功能之后,现在可以进行更改以进一步自定义你的环境。 在此示例中,您将在代码空间启动时添加属性以安装扩展和项目依赖项。
1. In the Explorer, select the `devcontainer.json` file from the tree to open it. You might have to expand the `.devcontainer` folder to see it.
1. 在资源管理器中,从树中选择 `devcontainer.json` 文件以将其打开。 可能需要展开 `.devcontainer` 文件夹才能看到它。
![devcontainer.json file in the Explorer](/assets/images/help/codespaces/devcontainers-options.png)
![Explorer 中的 devcontainer.json 文件](/assets/images/help/codespaces/devcontainers-options.png)
2. Add the following lines to your `devcontainer.json` file after `extensions`.
2. 将以下行添加到 `devcontainer.json` 文件的 `extensions` 之后:
```json{:copy}
"postCreateCommand": "npm install",
@@ -162,22 +166,22 @@ With your dev container configuration added and a basic understanding of what ev
{% data reusables.codespaces.rebuild-reason %}
## Step 4: Run your application
## 步骤 4运行应用程序
In the previous section, you used the `postCreateCommand` to install a set of packages via npm. You can now use this to run our application with npm.
在上一部分中,你使用 `postCreateCommand` 通过 npm 安装了一组包。 您现在可以使用它来通过 npm 运行应用程序。
1. Run your application by pressing `F5`.
1. `F5` 运行应用程序。
2. When your project starts, you should see a "toast" notification message at the bottom right corner of {% data variables.product.prodname_vscode_shortname %}, containing a prompt to connect to the port your project uses.
2. 项目启动时,应会在 {% data variables.product.prodname_vscode_shortname %} 的右下角看到一条“toast”通知消息其中包含连接到项目使用的端口的提示。
![Port forwarding "toast" notification](/assets/images/help/codespaces/codespaces-port-toast.png)
![端口转发“toast”通知](/assets/images/help/codespaces/codespaces-port-toast.png)
## Step 5: Commit your changes
## 步骤 5提交更改
{% data reusables.codespaces.committing-link-to-procedure %}
## Next steps
## 后续步骤
You should now be ready start developing your Java project in {% data variables.product.prodname_github_codespaces %}. Here are some additional resources for more advanced scenarios.
现在,你应该准备好了在 {% data variables.product.prodname_github_codespaces %} 中开始开发 Java 项目。 以下是用于更高级场景的一些额外资源。
{% data reusables.codespaces.next-steps-adding-devcontainer %}

View File

@@ -1,8 +1,8 @@
---
title: Setting up your Node.js project for GitHub Codespaces
title: GitHub Codespaces 设置 Node.js 项目
allowTitleToDifferFromFilename: true
shortTitle: Setting up your Node.js project
intro: 'Get started with your JavaScript, Node.js, or TypeScript project in {% data variables.product.prodname_github_codespaces %} by creating a custom dev container.'
intro: '通过创建自定义开发容器,开始在 {% data variables.product.prodname_github_codespaces %} 中使用 JavaScript、Node.js 或 TypeScript 项目。'
versions:
fpt: '*'
ghec: '*'
@@ -16,54 +16,57 @@ topics:
- JavaScript
hasExperimentalAlternative: true
hidden: true
ms.openlocfilehash: 19c29f7d3c8110d1c671a9af46227a399a467800
ms.sourcegitcommit: e8c012864f13f9146e53fcb0699e2928c949ffa8
ms.translationtype: HT
ms.contentlocale: zh-CN
ms.lasthandoff: 11/09/2022
ms.locfileid: '148159436'
---
## 简介
本指南介绍如何设置 JavaScript、Node.js 或 TypeScript 项目 {% data reusables.codespaces.setting-up-project-intro %}
### 先决条件
## Introduction
- 您应该在 {% data variables.product.prodname_dotcom_the_website %} 的仓库中有现有的 JavaScript、Node.js 或 TypeScript 项目。 如果没有项目,可以使用以下示例尝试本教程: https://github.com/microsoft/vscode-remote-try-node
- 必须为组织启用 {% data variables.product.prodname_github_codespaces %}。
This guide shows you how to set up your JavaScript, Node.js, or TypeScript project {% data reusables.codespaces.setting-up-project-intro %}
## 步骤 1在代码空间中打开项目
### Prerequisites
1. 在存储库名称下,使用“{% octicon "code" aria-label="The code icon" %} 代码”下拉菜单然后在“Codespaces”选项卡中单击加号 ({% octicon "plus" aria-label="The plus icon" %}) 。
- You should have an existing JavaScript, Node.js, or TypeScript project in a repository on {% data variables.product.prodname_dotcom_the_website %}. If you don't have a project, you can try this tutorial with the following example: https://github.com/microsoft/vscode-remote-try-node
- You must have {% data variables.product.prodname_github_codespaces %} enabled for your organization.
![新建代码空间按钮](/assets/images/help/codespaces/new-codespace-button.png)
## Step 1: Open your project in a codespace
1. Under the repository name, use the **{% octicon "code" aria-label="The code icon" %} Code** dropdown menu, and in the **Codespaces** tab, click the plus sign ({% octicon "plus" aria-label="The plus icon" %}).
![New codespace button](/assets/images/help/codespaces/new-codespace-button.png)
When you create a codespace, your project is created on a remote VM that is dedicated to you. By default, the container for your codespace has many languages and runtimes including Node.js, JavaScript, Typescript, nvm, npm, and yarn. It also includes a common set of tools like git, wget, rsync, openssh, and nano.
创建代码空间时,您的项目是在专用于您的远程 VM 上创建的。 默认情况下,代码空间的容器有许多语言和运行时,包括 Node.js、JavaScript、Typescript、nvm、npm 和 yarn。 它还包括一套常见的工具,例如 git、wget、rsync、openssh 和 nano。
{% data reusables.codespaces.customize-vcpus-and-ram %}
## Step 2: Add a dev container configuration to your repository from a template
## 步骤 2从模板将开发容器配置添加到存储库
The default development container, or "dev container," for {% data variables.product.prodname_github_codespaces %} will support running Node.js projects like [vscode-remote-try-node](https://github.com/microsoft/vscode-remote-try-node) out of the box. However, we recommend that you configure your own dev container, as this allows you to define any particular tools and scripts your project needs. This will ensure a fully reproducible environment for all {% data variables.product.prodname_github_codespaces %} users in your repository.
{% data variables.product.prodname_github_codespaces %} 的默认开发容器将支持立即运行 [vscode-remote-try-node](https://github.com/microsoft/vscode-remote-try-node) 等 Node.js 项目。 但是,我们建议配置自己的开发容器,因为这样就可以定义项目所需的任何特定工具和脚本。 这将确保存储库中的所有 {% data variables.product.prodname_github_codespaces %} 用户都拥有完全可复制的环境。
{% data reusables.codespaces.setup-custom-devcontainer %}
{% data reusables.codespaces.command-palette-container %}
1. For this example, click **Node.js**. If you need additional features you can select any container thats specific to Node or a combination of tools such as Node and MongoDB.
1. 对于本示例请单击“Node.js”。 如果需要其他功能,您可以选择任何特定于节点或工具(如节点和 MongoDB)组合的容器。
![Select Node option from the list](/assets/images/help/codespaces/add-node-prebuilt-container.png)
![从列表中选择节点选项](/assets/images/help/codespaces/add-node-prebuilt-container.png)
1. Click the recommended version of Node.js.
1. 单击推荐的 Node.js 版本。
![Node.js version selection](/assets/images/help/codespaces/add-node-version.png)
![Node.js 版本选择](/assets/images/help/codespaces/add-node-version.png)
{% data reusables.codespaces.rebuild-command %}
### Anatomy of your dev container
### 开发容器的剖析
Adding the Node.js dev container template adds a `.devcontainer` directory to the root of your project's repository with the following files:
添加 Node.js 开发容器模板会将 `.devcontainer` 目录添加到项目存储库的根目录中,其中包含以下文件:
- `devcontainer.json`
- Dockerfile
The newly added `devcontainer.json` file defines a few properties that are described after the sample.
新添加的 `devcontainer.json` 文件定义了在示例之后描述的几个属性。
#### devcontainer.json
@@ -71,46 +74,46 @@ The newly added `devcontainer.json` file defines a few properties that are descr
// For format details, see https://aka.ms/devcontainer.json. For config options, see the README at:
// https://github.com/microsoft/vscode-dev-containers/tree/v0.162.0/containers/javascript-node
{
"name": "Node.js",
"build": {
"dockerfile": "Dockerfile",
// Update 'VARIANT' to pick a Node version: 10, 12, 14
"args": { "VARIANT": "14" }
},
"name": "Node.js",
"build": {
"dockerfile": "Dockerfile",
// Update 'VARIANT' to pick a Node version: 10, 12, 14
"args": { "VARIANT": "14" }
},
// Set *default* container specific settings.json values on container create.
"settings": {
"terminal.integrated.shell.linux": "/bin/bash"
},
// Set *default* container specific settings.json values on container create.
"settings": {
"terminal.integrated.shell.linux": "/bin/bash"
},
// Add the IDs of extensions you want installed when the container is created.
"extensions": [
"dbaeumer.vscode-eslint"
],
// Add the IDs of extensions you want installed when the container is created.
"extensions": [
"dbaeumer.vscode-eslint"
],
// Use 'forwardPorts' to make a list of ports inside the container available locally.
// "forwardPorts": [],
// Use 'forwardPorts' to make a list of ports inside the container available locally.
// "forwardPorts": [],
// Use 'postCreateCommand' to run commands after the container is created.
// "postCreateCommand": "yarn install",
// Use 'postCreateCommand' to run commands after the container is created.
// "postCreateCommand": "yarn install",
// Comment out connect as root instead. More info: https://aka.ms/vscode-remote/containers/non-root.
"remoteUser": "node"
// Comment out connect as root instead. More info: https://aka.ms/vscode-remote/containers/non-root.
"remoteUser": "node"
}
```
- **name** - You can name your dev container anything, this is just the default.
- **build** - The build properties.
- **dockerfile** - In the `build` object, `dockerfile` contains the path to the Dockerfile that was also added from the template.
- name - 可以将开发容器命名为任何名称,这只是默认名称。
- build - 生成属性。
- dockerfile - 在 `build` 对象中,`dockerfile` 包含 Dockerfile 的路径,该文件也是从模板中添加的。
- **args**
- **variant**: This file only contains one build argument, which is the node variant we want to use that is passed into the Dockerfile.
- **settings** - These are {% data variables.product.prodname_vscode %} settings that you can set.
- **terminal.integrated.shell.linux** - While bash is the default here, you could use other terminal shells by modifying this.
- **extensions** - These are extensions included by default.
- **dbaeumer.vscode-eslint** - ES lint is a great extension for linting, but for JavaScript there are a number of great Marketplace extensions you could also include.
- **forwardPorts** - Any ports listed here will be forwarded automatically. For more information, see "[Forwarding ports in your codespace](/codespaces/developing-in-codespaces/forwarding-ports-in-your-codespace)."
- **postCreateCommand** - Use this to run commands that aren't defined in the Dockerfile, after your codespace is created.
- **remoteUser** - By default, youre running as the vscode user, but you can optionally set this to root.
- variant:此文件仅包含一个生成参数,即我们要使用并传递到 Dockerfile 的节点变体。
- settings - 这些是你可以设置的 {% data variables.product.prodname_vscode %} 设置。
- terminal.integrated.shell.linux - 虽然 bash 是此处的默认设置,但你可以通过修改它来使用其他终端 shell。
- extensions - 这些是默认包含的扩展。
- dbaeumer.vscode-eslint - ES lint 是 Lint 分析的良好扩展,但是对于 JavaScript还可以包括许多出色的市场扩展。
- **forwardPorts** - 此处列出的任何端口都将自动转发。 有关详细信息,请参阅“[ codespace 中转发端口](/codespaces/developing-in-codespaces/forwarding-ports-in-your-codespace)。”
- postCreateCommand - 使用此方法在创建 codespace 后,运行未在 Dockerfile 中定义的命令。
- **remoteUser** - 默认情况下以 vscode 用户身份运行,但可以选择将其设置为 root
#### Dockerfile
@@ -131,17 +134,17 @@ FROM mcr.microsoft.com/vscode/devcontainers/javascript-node:0-${VARIANT}
# RUN su node -c "npm install -g <your-package-list-here>"
```
You can use the Dockerfile to add additional container layers to specify OS packages, node versions, or global packages we want included in our container.
您可以使用 Dockerfile 添加其他容器层,以指定要包含在容器中的操作系统包、节点版本或全局包。
## Step 3: Modify your devcontainer.json file
## 步骤 3修改 devcontainer.json 文件
With your dev container configuration added and a basic understanding of what everything does, you can now make changes to customize your environment further. In this example, you'll add properties to install npm when your codespace launches and make a list of ports inside the container available locally.
添加了开发容器配置并基本了解所有功能之后,现在可以进行更改以进一步自定义你的环境。 在此示例中,您将添加属性以在代码空间启动时安装 npm并使容器内的端口列表在本地可用。
1. In the Explorer, select the `devcontainer.json` file from the tree to open it. You might have to expand the `.devcontainer` folder to see it.
1. 在资源管理器中,从树中选择 `devcontainer.json` 文件以将其打开。 可能需要展开 `.devcontainer` 文件夹才能看到它。
![devcontainer.json file in the Explorer](/assets/images/help/codespaces/devcontainers-options.png)
![Explorer 中的 devcontainer.json 文件](/assets/images/help/codespaces/devcontainers-options.png)
2. Add the following lines to your `devcontainer.json` file after `extensions`:
2. 将以下行添加到 `devcontainer.json` 文件的 `extensions` 之后:
```json{:copy}
"postCreateCommand": "npm install",
@@ -154,24 +157,24 @@ With your dev container configuration added and a basic understanding of what ev
{% data reusables.codespaces.rebuild-reason %}
## Step 4: Run your application
## 步骤 4运行应用程序
In the previous section, you used the `postCreateCommand` to installing a set of packages via npm. You can now use this to run our application with npm.
在上一部分中,你使用 `postCreateCommand` 通过 npm 安装了一组包。 您现在可以使用它来通过 npm 运行应用程序。
1. Run your start command in the terminal with`npm start`.
1. 在终端中使用 `npm start` 运行启动命令。
![npm start in terminal](/assets/images/help/codespaces/codespaces-npmstart.png)
![终端的 npm 启动](/assets/images/help/codespaces/codespaces-npmstart.png)
2. When your project starts, you should see a "toast" notification message at the bottom right corner of {% data variables.product.prodname_vscode_shortname %}, containing a prompt to connect to the port your project uses.
2. 项目启动时,应会在 {% data variables.product.prodname_vscode_shortname %} 的右下角看到一条“toast”通知消息其中包含连接到项目使用的端口的提示。
![Port forwarding "toast" notification](/assets/images/help/codespaces/codespaces-port-toast.png)
![端口转发“toast”通知](/assets/images/help/codespaces/codespaces-port-toast.png)
## Step 5: Commit your changes
## 步骤 5提交更改
{% data reusables.codespaces.committing-link-to-procedure %}
## Next steps
## 后续步骤
You should now be ready start developing your JavaScript project in {% data variables.product.prodname_github_codespaces %}. Here are some additional resources for more advanced scenarios.
现在,你应该准备好了在 {% data variables.product.prodname_github_codespaces %} 中开始开发 JavaScript 项目。 以下是用于更高级场景的一些额外资源。
{% data reusables.codespaces.next-steps-adding-devcontainer %}

View File

@@ -1,8 +1,8 @@
---
title: Setting up your Python project for GitHub Codespaces
title: GitHub Codespaces 设置 Python 项目
allowTitleToDifferFromFilename: true
shortTitle: Setting up your Python project
intro: 'Get started with your Python project in {% data variables.product.prodname_github_codespaces %} by creating a custom dev container.'
intro: '通过创建自定义开发容器,开始在 {% data variables.product.prodname_github_codespaces %} 中使用 Python 项目。'
versions:
fpt: '*'
ghec: '*'
@@ -15,113 +15,117 @@ topics:
- Python
hasExperimentalAlternative: true
hidden: true
ms.openlocfilehash: 2d9c627907f447a3efd873fceba963b899b57c39
ms.sourcegitcommit: e8c012864f13f9146e53fcb0699e2928c949ffa8
ms.translationtype: HT
ms.contentlocale: zh-CN
ms.lasthandoff: 11/09/2022
ms.locfileid: '148159422'
---
## 简介
## Introduction
本指南介绍如何设置 Python 项目 {% data reusables.codespaces.setting-up-project-intro %}
This guide shows you how to set up your Python project {% data reusables.codespaces.setting-up-project-intro %}
### 先决条件
### Prerequisites
- 您应该在 {% data variables.product.prodname_dotcom_the_website %} 的仓库中有现有的 Python 项目。 如果没有项目,可以使用以下示例尝试本教程: https://github.com/2percentsilk/python-quickstart 。
- 必须为组织启用 {% data variables.product.prodname_github_codespaces %}。
- You should have an existing Python project in a repository on {% data variables.product.prodname_dotcom_the_website %}. If you don't have a project, you can try this tutorial with the following example: https://github.com/2percentsilk/python-quickstart.
- You must have {% data variables.product.prodname_github_codespaces %} enabled for your organization.
## 步骤 1在代码空间中打开项目
## Step 1: Open your project in a codespace
1. 在存储库名称下,使用“{% octicon "code" aria-label="The code icon" %} 代码”下拉菜单然后在“Codespaces”选项卡中单击加号 ({% octicon "plus" aria-label="The plus icon" %}) 。
1. Under the repository name, use the **{% octicon "code" aria-label="The code icon" %} Code** dropdown menu, and in the **Codespaces** tab, click the plus sign ({% octicon "plus" aria-label="The plus icon" %}).
![新建代码空间按钮](/assets/images/help/codespaces/new-codespace-button.png)
![New codespace button](/assets/images/help/codespaces/new-codespace-button.png)
When you create a codespace, your project is created on a remote VM that is dedicated to you. By default, the container for your codespace has many languages and runtimes including Node.js, JavaScript, Typescript, nvm, npm, and yarn. It also includes a common set of tools like git, wget, rsync, openssh, and nano.
创建代码空间时,您的项目是在专用于您的远程 VM 上创建的。 默认情况下,代码空间的容器有许多语言和运行时,包括 Node.js、JavaScript、Typescript、nvm、npm 和 yarn。 它还包括一套常见的工具,例如 git、wget、rsync、openssh 和 nano。
{% data reusables.codespaces.customize-vcpus-and-ram %}
## Step 2: Add a dev container configuration to your repository from a template
## 步骤 2从模板将开发容器配置添加到存储库
The default development container, or "dev container," for {% data variables.product.prodname_github_codespaces %} comes with the latest Python version, package managers (pip, Miniconda), and other common tools preinstalled. However, we recommend that you configure your own dev container to include all of the tools and scripts that your project needs. This will ensure a fully reproducible environment for all {% data variables.product.prodname_github_codespaces %} users in your repository.
{% data variables.product.prodname_github_codespaces %} 的默认开发容器预先安装了最新的 Python 版本、包管理器(pipMiniconda)和其他常用工具。 但是,我们建议配置自己的开发容器,以包含项目所需的所有工具和脚本。 这将确保存储库中的所有 {% data variables.product.prodname_github_codespaces %} 用户都拥有完全可复制的环境。
{% data reusables.codespaces.setup-custom-devcontainer %}
{% data reusables.codespaces.command-palette-container %}
1. For this example, click **Python 3**. If you need additional features you can select any container thats specific to Python or a combination of tools such as Python 3 and PostgreSQL.
![Select Python option from the list](/assets/images/help/codespaces/add-python-prebuilt-container.png)
1. Click the recommended version of Python.
![Python version selection](/assets/images/help/codespaces/add-python-version.png)
1. Accept the default option to add Node.js to your customization.
![Add Node.js selection](/assets/images/help/codespaces/add-nodejs-selection.png)
{% data reusables.codespaces.rebuild-command %}
1. 对于本示例请单击“Python 3”。 如果需要其他功能,您可以选择任何特定于 Python 或工具(如 Python 3 PostgreSQL)组合的容器。
![从列表中选择 Python 选项](/assets/images/help/codespaces/add-python-prebuilt-container.png)
1. 单击推荐的 Python 版本。
![Python 版本选择](/assets/images/help/codespaces/add-python-version.png)
1. 接受默认选项,将 Node.js 添加到您的自定义中。
![添加 Node.js 选择](/assets/images/help/codespaces/add-nodejs-selection.png) {% data reusables.codespaces.rebuild-command %}
### Anatomy of your dev container
### 开发容器的剖析
Adding the Python dev container template adds a `.devcontainer` directory to the root of your project's repository with the following files:
添加 Python 开发容器模板会将 `.devcontainer` 目录添加到项目存储库的根目录中,其中包含以下文件:
- `devcontainer.json`
- Dockerfile
The newly added `devcontainer.json` file defines a few properties that are described after the sample.
新添加的 `devcontainer.json` 文件定义了在示例之后描述的几个属性。
#### devcontainer.json
```json
{
"name": "Python 3",
"build": {
"dockerfile": "Dockerfile",
"context": "..",
"args": {
// Update 'VARIANT' to pick a Python version: 3, 3.6, 3.7, 3.8, 3.9
"VARIANT": "3",
// Options
"INSTALL_NODE": "true",
"NODE_VERSION": "lts/*"
}
},
"name": "Python 3",
"build": {
"dockerfile": "Dockerfile",
"context": "..",
"args": {
// Update 'VARIANT' to pick a Python version: 3, 3.6, 3.7, 3.8, 3.9
"VARIANT": "3",
// Options
"INSTALL_NODE": "true",
"NODE_VERSION": "lts/*"
}
},
// Set *default* container specific settings.json values on container create.
"settings": {
"terminal.integrated.shell.linux": "/bin/bash",
"python.pythonPath": "/usr/local/bin/python",
"python.linting.enabled": true,
"python.linting.pylintEnabled": true,
"python.formatting.autopep8Path": "/usr/local/py-utils/bin/autopep8",
"python.formatting.blackPath": "/usr/local/py-utils/bin/black",
"python.formatting.yapfPath": "/usr/local/py-utils/bin/yapf",
"python.linting.banditPath": "/usr/local/py-utils/bin/bandit",
"python.linting.flake8Path": "/usr/local/py-utils/bin/flake8",
"python.linting.mypyPath": "/usr/local/py-utils/bin/mypy",
"python.linting.pycodestylePath": "/usr/local/py-utils/bin/pycodestyle",
"python.linting.pydocstylePath": "/usr/local/py-utils/bin/pydocstyle",
"python.linting.pylintPath": "/usr/local/py-utils/bin/pylint"
},
// Set *default* container specific settings.json values on container create.
"settings": {
"terminal.integrated.shell.linux": "/bin/bash",
"python.pythonPath": "/usr/local/bin/python",
"python.linting.enabled": true,
"python.linting.pylintEnabled": true,
"python.formatting.autopep8Path": "/usr/local/py-utils/bin/autopep8",
"python.formatting.blackPath": "/usr/local/py-utils/bin/black",
"python.formatting.yapfPath": "/usr/local/py-utils/bin/yapf",
"python.linting.banditPath": "/usr/local/py-utils/bin/bandit",
"python.linting.flake8Path": "/usr/local/py-utils/bin/flake8",
"python.linting.mypyPath": "/usr/local/py-utils/bin/mypy",
"python.linting.pycodestylePath": "/usr/local/py-utils/bin/pycodestyle",
"python.linting.pydocstylePath": "/usr/local/py-utils/bin/pydocstyle",
"python.linting.pylintPath": "/usr/local/py-utils/bin/pylint"
},
// Add the IDs of extensions you want installed when the container is created.
"extensions": [
"ms-python.python"
],
// Add the IDs of extensions you want installed when the container is created.
"extensions": [
"ms-python.python"
],
// Use 'forwardPorts' to make a list of ports inside the container available locally.
// "forwardPorts": [],
// Use 'forwardPorts' to make a list of ports inside the container available locally.
// "forwardPorts": [],
// Use 'postCreateCommand' to run commands after the container is created.
// "postCreateCommand": "pip3 install --user -r requirements.txt",
// Use 'postCreateCommand' to run commands after the container is created.
// "postCreateCommand": "pip3 install --user -r requirements.txt",
// Comment out connect as root instead. More info: https://aka.ms/vscode-remote/containers/non-root.
"remoteUser": "vscode"
// Comment out connect as root instead. More info: https://aka.ms/vscode-remote/containers/non-root.
"remoteUser": "vscode"
}
```
- **name** - You can name our dev container anything, this is just the default.
- **build** - The build properties.
- **dockerfile** - In the `build` object, `dockerfile` contains the path to the Dockerfile that was also added from the template.
- name - 可以将开发容器命名为任何名称,这只是默认名称。
- build - 生成属性。
- dockerfile - 在 `build` 对象中,`dockerfile` 包含 Dockerfile 的路径,该文件也是从模板中添加的。
- **args**
- **variant**: This file only contains one build argument, which is the node variant we want to use that is passed into the Dockerfile.
- **settings** - These are {% data variables.product.prodname_vscode %} settings.
- **terminal.integrated.shell.linux** - While bash is the default here, you could use other terminal shells by modifying this.
- **extensions** - These are extensions included by default.
- **ms-python.python** - The Microsoft Python extension provides rich support for the Python language (for all actively supported versions of the language: >=3.6), including features such as IntelliSense, linting, debugging, code navigation, code formatting, refactoring, variable explorer, test explorer, and more.
- **forwardPorts** - Any ports listed here will be forwarded automatically. For more information, see "[Forwarding ports in your codespace](/codespaces/developing-in-codespaces/forwarding-ports-in-your-codespace)."
- **postCreateCommand** - Use this to run commands that aren't defined in the Dockerfile, like `pip3 install -r requirements`, after your codespace is created.
- **remoteUser** - By default, youre running as the `vscode` user, but you can optionally set this to `root`.
- variant:此文件仅包含一个生成参数,即我们要使用并传递到 Dockerfile 的节点变体。
- settings - 这些是 {% data variables.product.prodname_vscode %} 设置。
- terminal.integrated.shell.linux - 虽然 bash 是此处的默认设置,但你可以通过修改它来使用其他终端 shell。
- extensions - 这些是默认包含的扩展。
- **ms-python.python** - Microsoft Python 扩展为 Python 语言提供丰富的支持(对于所有有效支持的语言版本:>=3.6),包括 IntelliSenselinting、调试、代码导航、代码格式化、重构、变量资源管理器、测试资源管理器等功能。
- **forwardPorts** - 此处列出的任何端口都将自动转发。 有关详细信息,请参阅“[ codespace 中转发端口](/codespaces/developing-in-codespaces/forwarding-ports-in-your-codespace)。”
- postCreateCommand - 使用此方法在创建 codespace 后,运行未在 Dockerfile 中定义的命令,例如 `pip3 install -r requirements`
- **remoteUser** - 默认情况下以 `vscode` 用户身份运行,但可以选择将其设置为 `root`
#### Dockerfile
@@ -148,27 +152,27 @@ RUN if [ "${INSTALL_NODE}" = "true" ]; then su vscode -c "umask 0002 && . /usr/l
# RUN su vscode -c "source /usr/local/share/nvm/nvm.sh && npm install -g <your-package-here>" 2>&1
```
You can use the Dockerfile to add additional container layers to specify OS packages, node versions, or global packages we want included in our container.
您可以使用 Dockerfile 添加其他容器层,以指定要包含在容器中的操作系统包、节点版本或全局包。
## Step 3: Modify your devcontainer.json file
## 步骤 3修改 devcontainer.json 文件
With your dev container configuration added and a basic understanding of what everything does, you can now make changes to customize your environment further. In this example, you'll add properties to install extensions and your project dependencies when your codespace launches.
添加了开发容器配置并基本了解所有功能之后,现在可以进行更改以进一步自定义你的环境。 在此示例中,您将在代码空间启动时添加属性以安装扩展和项目依赖项。
1. In the Explorer, expand the `.devcontainer` folder and select the `devcontainer.json` file from the tree to open it.
1. 在资源管理器中,展开 `.devcontainer` 文件夹,然后从树中选择 `devcontainer.json` 文件以将其打开。
![devcontainer.json file in the Explorer](/assets/images/help/codespaces/devcontainers-options.png)
![Explorer 中的 devcontainer.json 文件](/assets/images/help/codespaces/devcontainers-options.png)
2. Update the `extensions` list in your `devcontainer.json` file to add a few extensions that are useful when working with your project.
2. 更新 `devcontainer.json` 文件中的 `extensions` 列表,以添加一些在处理项目时有用的扩展。
```json{:copy}
"extensions": [
"ms-python.python",
"cstrap.flask-snippets",
"streetsidesoftware.code-spell-checker"
],
"ms-python.python",
"cstrap.flask-snippets",
"streetsidesoftware.code-spell-checker"
],
```
3. Uncomment the `postCreateCommand` to auto-install requirements as part of the codespaces setup process.
3. 在代码空间设置过程中取消注释 `postCreateCommand` 以自动安装要求。
```json{:copy}
// Use 'postCreateCommand' to run commands after the container is created.
@@ -179,26 +183,26 @@ With your dev container configuration added and a basic understanding of what ev
{% data reusables.codespaces.rebuild-reason %}
5. Check your changes were successfully applied by verifying the Code Spell Checker and Flask Snippet extensions were installed.
5. 通过验证是否安装了 Code Spell Checker Flask Snippet 扩展,检查更改是否成功应用。
![Extensions list](/assets/images/help/codespaces/python-extensions.png)
![扩展列表](/assets/images/help/codespaces/python-extensions.png)
## Step 4: Run your application
## 步骤 4运行应用程序
In the previous section, you used the `postCreateCommand` to install a set of packages via pip3. With your dependencies now installed, you can run your application.
在上一部分中,你使用 `postCreateCommand` 通过 pip3 安装了一组包。 现已安装您的依赖项,您可以运行应用程序。
1. Run your application by pressing `F5` or entering `python -m flask run` in the codespace terminal.
1. 通过按 `F5` 或在 codespace 终端中输入 `python -m flask run` 来运行你的应用程序。
2. When your project starts, you should see a "toast" notification message at the bottom right corner of {% data variables.product.prodname_vscode_shortname %}, containing a prompt to connect to the port your project uses.
2. 项目启动时,应会在 {% data variables.product.prodname_vscode_shortname %} 的右下角看到一条“toast”通知消息其中包含连接到项目使用的端口的提示。
![Port forwarding "toast" notification](/assets/images/help/codespaces/python-port-forwarding.png)
![端口转发“toast”通知](/assets/images/help/codespaces/python-port-forwarding.png)
## Step 5: Commit your changes
## 步骤 5提交更改
{% data reusables.codespaces.committing-link-to-procedure %}
## Next steps
## 后续步骤
You should now be ready start developing your Python project in {% data variables.product.prodname_github_codespaces %}. Here are some additional resources for more advanced scenarios.
现在,应准备开始在 {% data variables.product.prodname_github_codespaces %} 中开发 Python 项目。 以下是用于更高级场景的一些额外资源。
{% data reusables.codespaces.next-steps-adding-devcontainer %}

View File

@@ -1,6 +1,6 @@
---
title: Exporting changes to a branch
intro: This article provides steps for exporting your codespace changes to a branch.
title: 将更改导出到分支
intro: 本文提供将代码空间更改导出到分支的步骤。
versions:
fpt: '*'
ghec: '*'
@@ -8,20 +8,25 @@ type: reference
topics:
- Codespaces
shortTitle: Exporting changes
ms.openlocfilehash: 2a7dee4725af31f3983e753b4202f94be1742556
ms.sourcegitcommit: e8c012864f13f9146e53fcb0699e2928c949ffa8
ms.translationtype: HT
ms.contentlocale: zh-CN
ms.lasthandoff: 11/09/2022
ms.locfileid: '148159437'
---
## 将更改导出到分支
## Exporting changes to a branch
使用 {% data variables.product.prodname_github_codespaces %} 时,你可能希望将更改导出到分支,而无需启动 codespace。 当达到[支出限制](/billing/managing-billing-for-github-codespaces/managing-spending-limits-for-codespaces)或在访问 codespace 时遇到一般性问题时,这会很有用。
While using {% data variables.product.prodname_github_codespaces %}, you may want to export your changes to a branch without launching your codespace. This can be useful when you have hit a [spending limit](/billing/managing-billing-for-github-codespaces/managing-spending-limits-for-codespaces) or have a general issue accessing your codespace.
如果未发布 codespace通过模板创建并且未与 {% data variables.product.product_name %} 上的存储库相关联),则无法将更改导出到分支,但无需启动 codespace 即可将 codespace 发布到新存储库。 有关详细信息,请参阅“[通过模板创建 codespace](/codespaces/developing-in-codespaces/creating-a-codespace-from-a-template#publishing-from-githubcom)”。
If your codespace is unpublished (created from a template and not associated with a repository on {% data variables.product.product_name %}), then you won't be able to export changes to a branch, but you can publish the codespace to a new repository without launching the codespace. For more information, see "[Creating a codespace from a template](/codespaces/developing-in-codespaces/creating-a-codespace-from-a-template#publishing-from-githubcom)."
将更改导出到分支:
To export your changes to a branch:
{% data reusables.codespaces.your-codespaces-procedure-step %} 或者,对于单个存储库,单击“{% octicon "code" aria-label="The code icon" %} 代码”菜单。
1. 单击要从中导出的 codespace 右侧的省略号 (...)。
2. 选择“{% octicon "git-branch" aria-label="The git branch icon" %} 将更改导出到分支”。
{% data reusables.codespaces.your-codespaces-procedure-step %} Or, for an individual repository, click the **{% octicon "code" aria-label="The code icon" %} Code** menu.
1. Click the ellipsis (**...**) to the right of the codespace you want to export from.
2. Select **{% octicon "git-branch" aria-label="The git branch icon" %} Export changes to branch**.
![将更改导出到分支](/assets/images/help/codespaces/export-changes-to-a-branch.png)
![Export changes to a branch](/assets/images/help/codespaces/export-changes-to-a-branch.png)
1. From the popover, select **Create branch**.
1. 从弹出窗口中选择“创建分支”。

View File

@@ -1,6 +1,6 @@
---
title: GitHub Codespaces logs
intro: 'Overview of the logs used by {% data variables.product.prodname_github_codespaces %}.'
title: GitHub Codespaces 日志
intro: '{% data variables.product.prodname_github_codespaces %} 使用的日志概述。'
versions:
fpt: '*'
ghec: '*'
@@ -11,50 +11,55 @@ topics:
shortTitle: Codespaces logs
redirect_from:
- /codespaces/troubleshooting/codespaces-logs
ms.openlocfilehash: f5cd482888f58f85a051bb9b6e2c5d7c026ed9a9
ms.sourcegitcommit: e8c012864f13f9146e53fcb0699e2928c949ffa8
ms.translationtype: HT
ms.contentlocale: zh-CN
ms.lasthandoff: 11/09/2022
ms.locfileid: '148159485'
---
{% jetbrains %}
{% data reusables.codespaces.codespaces-jetbrains-beta-note %}
{% endjetbrains %}
Information on {% data variables.product.prodname_github_codespaces %} is output to various logs:
有关 {% data variables.product.prodname_github_codespaces %} 的信息将输出到各种日志:
{% webui %}
- Codespace logs
- Creation logs
- Browser console logs (for the {% data variables.product.prodname_vscode_shortname %} web client)
- 代码空间日志
- 创建日志
- 浏览器控制台日志(用于 {% data variables.product.prodname_vscode_shortname %} Web 客户端)
Extension logs are available if you are using {% data variables.product.prodname_github_codespaces %} in {% data variables.product.prodname_vscode_shortname %}. Click the "{% data variables.product.prodname_vscode %}" tab above for details.
如果要在 {% data variables.product.prodname_vscode_shortname %} 中使用 {% data variables.product.prodname_github_codespaces %},则可以使用扩展日志。 单击上面的“{% data variables.product.prodname_vscode %}”选项卡,了解详细信息。
{% endwebui %}
{% vscode %}
- Codespace logs
- Creation logs
- Extension logs (for the {% data variables.product.prodname_vscode_shortname %} desktop application)
- 代码空间日志
- 创建日志
- 扩展日志(用于 {% data variables.product.prodname_vscode_shortname %} 桌面应用程序)
Browser logs are available if you are using {% data variables.product.prodname_github_codespaces %} in your browser. Click the "Web browser" tab above for details.
如果要在浏览器中使用 {% data variables.product.prodname_github_codespaces %},则可以使用浏览器日志。 单击上面的“Web 浏览器”选项卡,了解详细信息。
{% endvscode %}
{% cli %}
- Codespace logs
- Creation logs
- 代码空间日志
- 创建日志
Other logs are available if you are using {% data variables.product.prodname_github_codespaces %} in {% data variables.product.prodname_vscode_shortname %} or in your web browser. Click the tabs above for details.
如果要在 {% data variables.product.prodname_vscode_shortname %} 或 Web 浏览器中使用 {% data variables.product.prodname_github_codespaces %},则可以使用其他日志。 单击上面的选项卡以了解详细信息。
{% endcli %}
{% jetbrains %}
- Creation logs
- 创建日志
Other logs are available if you are using {% data variables.product.prodname_github_codespaces %} in {% data variables.product.prodname_vscode_shortname %} or in your web browser. Click the tabs above for details.
如果要在 {% data variables.product.prodname_vscode_shortname %} 或 Web 浏览器中使用 {% data variables.product.prodname_github_codespaces %},则可以使用其他日志。 单击上面的选项卡以了解详细信息。
{% endjetbrains %}
@@ -62,10 +67,10 @@ Other logs are available if you are using {% data variables.product.prodname_git
{% data reusables.codespaces.codespace-logs %}
1. If you are using {% data variables.product.prodname_github_codespaces %} in the browser, ensure that you are connected to the codespace you want to debug.
1. Open the {% data variables.product.prodname_vscode_command_palette_shortname %} (<kbd>Shift</kbd>+<kbd>Command</kbd>+<kbd>P</kbd> (Mac) / <kbd>Ctrl</kbd>+<kbd>Shift</kbd>+<kbd>P</kbd> (Windows/Linux)) and type **Export logs**. Select **Codespaces: Export Logs** from the list to download the logs.
1. Define where to save the zip archive of logs then click **Save** (desktop) or click **OK** (web).
1. If you are using {% data variables.product.prodname_github_codespaces %} in the browser, right-click on the zip archive of logs from the Explorer view and select **Download…** to download them to your local machine.
1. 如果要在浏览器中使用 {% data variables.product.prodname_github_codespaces %},请确保已连接到要调试的 codespace。
1. 打开 {% data variables.product.prodname_vscode_command_palette_shortname %} (<kbd>Shift</kbd>+<kbd>Command</kbd>+<kbd>P</kbd> (Mac)/<kbd>Ctrl</kbd>+<kbd>Shift</kbd>+<kbd>P</kbd> (Windows/Linux)),然后键入“导出日志”。 从列表中选择“Codespaces: 导出日志”以下载日志。
1. 定义保存日志 zip 存档的位置,然后单击“保存”(桌面),或单击“确定”(Web) 。
1. 如果要在浏览器中使用 {% data variables.product.prodname_github_codespaces %},请右键单击“资源管理器”视图中日志的 zip 存档,然后选择“下载…” 将其下载到本地计算机。
{% endwebui %}
@@ -73,8 +78,8 @@ Other logs are available if you are using {% data variables.product.prodname_git
{% data reusables.codespaces.codespace-logs %}
1. Open the {% data variables.product.prodname_vscode_command_palette_shortname %} (<kbd>Shift</kbd>+<kbd>Command</kbd>+<kbd>P</kbd> (Mac) / <kbd>Ctrl</kbd>+<kbd>Shift</kbd>+<kbd>P</kbd> (Windows/Linux)) and type **Export logs**. Select **Codespaces: Export Logs** from the list to download the logs.
1. Define where to save the zip archive of logs then click **Save** (desktop) or click **OK** (web).
1. 打开 {% data variables.product.prodname_vscode_command_palette_shortname %} (<kbd>Shift</kbd>+<kbd>Command</kbd>+<kbd>P</kbd> (Mac)/<kbd>Ctrl</kbd>+<kbd>Shift</kbd>+<kbd>P</kbd> (Windows/Linux)),然后键入“导出日志”。 从列表中选择“Codespaces: 导出日志”以下载日志。
1. 定义保存日志 zip 存档的位置,然后单击“保存”(桌面),或单击“确定”(Web) 。
{% endvscode %}
@@ -82,28 +87,28 @@ Other logs are available if you are using {% data variables.product.prodname_git
{% data reusables.codespaces.codespace-logs %}
Currently you can't use {% data variables.product.prodname_cli %} to access these logs. To access them, open your codespace in {% data variables.product.prodname_vscode_shortname %} or in a browser.
目前,您无法使用 {% data variables.product.prodname_cli %} 来访问这些日志。 要访问它们,请在 {% data variables.product.prodname_vscode_shortname %} 或浏览器中打开 codespace。
{% endcli %}
## Creation logs
## 创建日志
These logs contain information about the container, dev container, and their configuration. They are useful for debugging configuration and setup problems.
这些日志包含有关容器、开发容器及其配置的信息。 它们对于调试配置和设置问题非常有用。
{% webui %}
1. Connect to the codespace you want to debug.
2. Open the {% data variables.product.prodname_vscode_command_palette_shortname %} (<kbd>Shift</kbd>+<kbd>Command</kbd>+<kbd>P</kbd> (Mac) / <kbd>Ctrl</kbd>+<kbd>Shift</kbd>+<kbd>P</kbd> (Windows/Linux)) and type **Creation logs**. Select **Codespaces: View Creation Log** from the list to open the `creation.log` file.
1. 连接到要调试的代码空间。
2. 打开 {% data variables.product.prodname_vscode_command_palette_shortname %} (<kbd>Shift</kbd>+<kbd>Command</kbd>+<kbd>P</kbd> (Mac)/<kbd>Ctrl</kbd>+<kbd>Shift</kbd>+<kbd>P</kbd> (Windows/Linux)),然后键入“创建日志”。 从列表中选择“Codespaces: 查看创建日志”以打开 `creation.log` 文件。
If you want to share the log with support, you can copy the text from the creation log into a text editor and save the file locally.
如果要与支持人员共享日志,可以将创建日志中的文本复制到文本编辑器中,并将文件保存在本地。
{% endwebui %}
{% vscode %}
Open the {% data variables.product.prodname_vscode_command_palette_shortname %} (<kbd>Shift</kbd>+<kbd>Command</kbd>+<kbd>P</kbd> (Mac) / <kbd>Ctrl</kbd>+<kbd>Shift</kbd>+<kbd>P</kbd> (Windows/Linux)) and type **Creation logs**. Select **Codespaces: View Creation Log** from the list to open the `creation.log` file.
打开 {% data variables.product.prodname_vscode_command_palette_shortname %} (<kbd>Shift</kbd>+<kbd>Command</kbd>+<kbd>P</kbd> (Mac)/<kbd>Ctrl</kbd>+<kbd>Shift</kbd>+<kbd>P</kbd> (Windows/Linux)),然后键入“创建日志”。 从列表中选择“Codespaces: 查看创建日志”以打开 `creation.log` 文件。
If you want to share the log with support, you can copy the text from the creation log into a text editor and save the file locally.
如果要与支持人员共享日志,可以将创建日志中的文本复制到文本编辑器中,并将文件保存在本地。
{% endvscode %}
@@ -111,15 +116,15 @@ If you want to share the log with support, you can copy the text from the creati
{% data reusables.cli.cli-learn-more %}
To see the creation log use the `gh codespace logs` subcommand. After entering the command choose from the list of codespaces that's displayed.
若要查看创建日志,请使用 `gh codespace logs` 子命令。 输入命令后,从显示的代码空间列表中进行选择。
```shell
gh codespace logs
```
For more information about this command, see [the {% data variables.product.prodname_cli %} manual](https://cli.github.com/manual/gh_codespace_logs).
有关此命令的详细信息,请参阅 [{% data variables.product.prodname_cli %} 手册](https://cli.github.com/manual/gh_codespace_logs)
If you want to share the log with support, you can save the output to a file:
如果要与支持人员共享日志,可以将输出保存到一个文件中:
```shell
gh codespace logs -c <CODESPACE-NAME> > /path/to/logs.txt
@@ -129,44 +134,44 @@ gh codespace logs -c <CODESPACE-NAME> > /path/to/logs.txt
{% vscode %}
## Extension logs
## 扩展日志
These logs are available for {% data variables.product.prodname_vscode_shortname %} desktop users only. They are useful if it seems like the {% data variables.product.prodname_github_codespaces %} extension or {% data variables.product.prodname_vscode_shortname %} editor are having issues that prevent creation or connection.
这些日志仅适用于 {% data variables.product.prodname_vscode_shortname %} 桌面用户。 如果看起来 {% data variables.product.prodname_github_codespaces %} 扩展或 {% data variables.product.prodname_vscode_shortname %} 编辑器遇到阻止创建或连接的问题,则它们很有用。
1. In {% data variables.product.prodname_vscode_shortname %}, open the Command Palette.
1. Type **Logs** and select **Developer: Open Extension Logs Folder** from the list to open the extension log folder in your system's file explorer.
1. {% data variables.product.prodname_vscode_shortname %} 中,打开命令面板。
1. 键入“日志”,然后从列表中选择“开发人员: 打开扩展日志文件夹”,以便在系统的文件资源管理器中打开扩展日志文件夹 。
From this view, you can access logs generated by the various extensions that you use in {% data variables.product.prodname_vscode_shortname %}. You will see logs for {% data variables.product.prodname_github_codespaces %}, {% data variables.product.prodname_dotcom %} Authentication, and Git, in addition to any other extensions you have enabled.
在此视图中,可以访问由在 {% data variables.product.prodname_vscode_shortname %} 中使用的各种扩展生成的日志。 除了已启用的任何其他扩展外,还将看到 {% data variables.product.prodname_github_codespaces %}{% data variables.product.prodname_dotcom %} 身份验证和 Git 的日志。
{% endvscode %}
{% webui %}
## Browser console logs
## 浏览器控制台日志
These logs are useful only if you want to debug problems with using {% data variables.product.prodname_github_codespaces %} in the browser. They are useful for debugging problems creating and connecting to {% data variables.product.prodname_github_codespaces %}.
仅当想要调试在浏览器中使用 {% data variables.product.prodname_github_codespaces %} 的问题时,这些日志才有用。 对于调试创建和连接到 {% data variables.product.prodname_github_codespaces %} 的问题,它们非常有用。
1. In the browser window for the codespace you want to debug, open the developer tools window.
1. Display the "Console" tab and click **errors** in the left sidebar to show only the errors.
1. In the log area on the right, right-click and select **Save as** to save a copy of the errors to your local machine.
![Save errors](/assets/images/help/codespaces/browser-console-log-save.png)
1. 在要调试的代码空间的浏览器窗口中,打开开发人员工具窗口。
1. 显示“控制”选项卡,然后单击左侧边栏中的“错误”以仅显示错误。
1. 在右侧的日志区域中,右键单击并选择“另存为”将错误的副本保存到本地计算机。
![保存错误](/assets/images/help/codespaces/browser-console-log-save.png)
{% endwebui %}
{% jetbrains %}
{% data reusables.codespaces.jetbrains-open-codespace-plugin %}
1. In the {% data variables.product.prodname_github_codespaces %} tool window, click the log icon.
1. {% data variables.product.prodname_github_codespaces %} 工具窗口中,单击日志图标。
![Screenshot of the log button](/assets/images/help/codespaces/jetbrains-plugin-icon-log.png)
![“日志”按钮的屏幕截图](/assets/images/help/codespaces/jetbrains-plugin-icon-log.png)
## JetBrains logs
## JetBrains 日志
You can download logs for the remote JetBrains IDE and the local client application by going to the **Help** menu in the JetBrains client application and clicking **Collect Host and Client Logs**.
通过转到 JetBrains 客户端应用程序中的“帮助”菜单并单击“收集主机和客户端日志”,来下载远程 JetBrains IDE 和本地客户端应用程序的日志 。
{% endjetbrains %}
## Further reading
## 延伸阅读
- "[Reviewing your organization's audit logs for {% data variables.product.prodname_github_codespaces %}](/codespaces/managing-codespaces-for-your-organization/reviewing-your-organizations-audit-logs-for-github-codespaces)"
- "[Reviewing your security logs for {% data variables.product.prodname_github_codespaces %}](/codespaces/managing-your-codespaces/reviewing-your-security-logs-for-github-codespaces)"
- [查看 {% data variables.product.prodname_github_codespaces %} 的组织审核日志](/codespaces/managing-codespaces-for-your-organization/reviewing-your-organizations-audit-logs-for-github-codespaces)
- [查看 {% data variables.product.prodname_github_codespaces %} 的安全日志](/codespaces/managing-your-codespaces/reviewing-your-security-logs-for-github-codespaces)

View File

@@ -1,7 +1,7 @@
---
title: Troubleshooting GitHub Codespaces
title: GitHub Codespaces 故障排除
shortTitle: Troubleshooting
intro: 'These guides provide information for troubleshooting {% data variables.product.prodname_github_codespaces %}'
intro: '这些指南提供了有关 {% data variables.product.prodname_github_codespaces %} 疑难解答的信息'
versions:
fpt: '*'
ghec: '*'
@@ -21,5 +21,11 @@ children:
- /troubleshooting-github-codespaces-clients
- /troubleshooting-gpg-verification-for-github-codespaces
- /working-with-support-for-github-codespaces
ms.openlocfilehash: 8704695a9ae39750bcc94229a62bb7eabcc6cdbe
ms.sourcegitcommit: 47e03737d09bed84dfedb7be5924d893d34ea1a8
ms.translationtype: HT
ms.contentlocale: zh-CN
ms.lasthandoff: 11/16/2022
ms.locfileid: '148167091'
---

View File

@@ -1,6 +1,6 @@
---
title: Troubleshooting creation and deletion of codespaces
intro: 'This article provides troubleshooting steps for common issues you may experience when creating or deleting a codespace, including storage and configuration issues.'
title: codespace 的创建和删除故障排除
intro: 本文提供了在创建或删除代码空间时可能遇到的常见问题(包括存储和配置问题)的疑难解答步骤。
versions:
fpt: '*'
ghec: '*'
@@ -8,89 +8,94 @@ type: reference
topics:
- Codespaces
shortTitle: Creation and deletion
ms.openlocfilehash: 09c3a73ec5e41f0170f1d3cd66df139bb2a497e5
ms.sourcegitcommit: e8c012864f13f9146e53fcb0699e2928c949ffa8
ms.translationtype: HT
ms.contentlocale: zh-CN
ms.lasthandoff: 11/09/2022
ms.locfileid: '148158691'
---
## 创建代码空间
## Creating codespaces
### 没有创建代码空间的权限
{% data variables.product.prodname_github_codespaces %} 并非对所有存储库都可用。 如果未显示用于创建 codespace 的选项,则 {% data variables.product.prodname_github_codespaces %} 可能不适用于该存储库。 有关详细信息,请参阅“[为存储库创建 codespace](/codespaces/developing-in-codespaces/creating-a-codespace-for-a-repository#access-to-codespaces)”。
### No access to create a codespace
{% data variables.product.prodname_github_codespaces %} is not available for all repositories. If the options for creating a codespace are not displayed, {% data variables.product.prodname_github_codespaces %} may not be available for that repository. For more information, see "[Creating a codespace for a repository](/codespaces/developing-in-codespaces/creating-a-codespace-for-a-repository#access-to-codespaces)."
如果个人帐户中每月剩余包含的 {% data variables.product.prodname_github_codespaces %} 使用量,或者设置了付款方式和支出限额,则将能够为公共存储库创建 codespaces。 但是,如果可以将更改推送到存储库,或者可以为存储库创建分支,则只能为专用存储库创建 codespace
Provided you have remaining monthly included usage of {% data variables.product.prodname_github_codespaces %} on your personal account, or you have set up a payment method and a spending limit, you will be able to create codespaces for public repositories. However, you can only create a codespace for a private repository if you can push changes to the repository, or you can fork the repository.
有关个人帐户包含的使用量和设置支出限制的详细信息,请参阅“[关于 {% data variables.product.prodname_github_codespaces %} 的计费](/billing/managing-billing-for-github-codespaces/about-billing-for-github-codespaces)”和“[管理 {% data variables.product.prodname_github_codespaces %} 的支出限制](/billing/managing-billing-for-github-codespaces/managing-spending-limits-for-github-codespaces)”。
For more information about included usage for personal accounts, and setting a spending limit, see "[About billing for {% data variables.product.prodname_github_codespaces %}](/billing/managing-billing-for-github-codespaces/about-billing-for-github-codespaces)" and "[Managing spending limits for {% data variables.product.prodname_github_codespaces %}](/billing/managing-billing-for-github-codespaces/managing-spending-limits-for-github-codespaces)."
### 代码空间在创建时未打开
### Codespace does not open when created
如果创建了代码空间,但未打开:
If you create a codespace and it does not open:
1. 如果出现缓存或报告问题,请尝试重新加载页面。
2. 转到 {% data variables.product.prodname_github_codespaces %} 页面: https://github.com/codespaces ,检查新的 codespace 是否在此处列出。 该过程可能已成功创建代码空间,但未向浏览器报告。 如果列出了新的代码空间,则可以直接从该页打开它。
3. 重试为存储库创建代码空间,以排除暂时性通信故障。
1. Try reloading the page in case there was a caching or reporting problem.
2. Go to your {% data variables.product.prodname_github_codespaces %} page: https://github.com/codespaces and check whether the new codespace is listed there. The process may have successfully created the codespace but failed to report back to your browser. If the new codespace is listed, you can open it directly from that page.
3. Retry creating the codespace for the repository to rule out a transient communication failure.
如果仍然无法为其中 {% data variables.product.prodname_github_codespaces %} 可用的存储库创建 codespace请 {% data reusables.codespaces.contact-support %}
If you still cannot create a codespace for a repository where {% data variables.product.prodname_github_codespaces %} is available, {% data reusables.codespaces.contact-support %}
### Codespace 创建失败
### Codespace creation fails
If the creation of a codespace fails, it's likely to be due to a temporary infrastructure issue in the cloud - for example, a problem provisioning a virtual machine for the codespace. A less common reason for failure is if it takes longer than an hour to build the container. In this case, the build is cancelled and codespace creation will fail.
如果创建 codespace 失败,则可能是由于云中的临时基础结构问题(例如,为 codespace 预配虚拟机时出现问题)。 失败的一个不太常见的原因是生成容器所需的时间超过一小时。 在这种情况下,将取消生成,并且 codespace 创建将失败。
{% note %}
**Note:** A codespace that was not successfully created is never going to be usable and should be deleted. For more information, see "[Deleting a codespace](/codespaces/developing-in-codespaces/deleting-a-codespace)."
注意:将永不使用未成功创建的 codespace并应将其删除。 有关详细信息,请参阅“[删除 codespace](/codespaces/developing-in-codespaces/deleting-a-codespace)”。
{% endnote %}
If you create a codespace and the creation fails:
如果创建 codespace 但创建失败:
1. Check {% data variables.product.prodname_dotcom %}'s [Status page](https://githubstatus.com) for any active incidents.
1. Go to [your {% data variables.product.prodname_github_codespaces %} page](https://github.com/codespaces), delete the codespace, and create a new codespace.
1. If the container is building, look at the logs that are streaming and make sure the build is not stuck. A container build that takes longer than one hour will be canceled, resulting in a failed creation.
1. 检查 {% data variables.product.prodname_dotcom %} 的[“状态”页](https://githubstatus.com)是否有任何活动事件。
1. 转到 [{% data variables.product.prodname_github_codespaces %} ](https://github.com/codespaces),删除 codespace然后创建新的 codespace
1. 如果容器正在生成,请查看正在流式传输的日志,并确保生成未停滞。 将取消花费超过一小时的容器生成,从而导致创建失败。
One common scenario where this could happen is if you have a script running that is prompting for user input and waiting for an answer. If this is the case, remove the interactive prompt so that the build can complete non-interactively.
发生这种情况的一种常见情况是,如果正在运行的脚本提示用户输入并等待答案。 如果是这种情况,请删除交互式提示,以便生成以非交互方式完成。
{% note %}
**Note**: To view the logs during a build:
* In the browser, click **View logs.**
注意:若要在生成期间查看日志,请执行以下操作:
* 在浏览器中,单击“查看日志”。
![Screenshot of the Codespaces web UI with the View logs link emphasized](/assets/images/help/codespaces/web-ui-view-logs.png)
![Codespaces Web UI 的屏幕截图,其中突出显示了“查看日志”链接](/assets/images/help/codespaces/web-ui-view-logs.png)
* In the VS Code desktop application, click **Building codespace** in the "Setting up remote connection" that's displayed.
* 在 VS Code 桌面应用程序中,单击显示的“设置远程链接”中的“生成 codespace”。
![Screenshot of VS Code with the Building codespace link emphasized](/assets/images/help/codespaces/vs-code-building-codespace.png)
![VS Code 的屏幕截图,其中突出显示了“生成 codespace”链接](/assets/images/help/codespaces/vs-code-building-codespace.png)
{% endnote %}
2. If you have a container that takes a long time to build, consider using prebuilds to speed up codespace creations. For more information, see "[Configuring prebuilds](/codespaces/prebuilding-your-codespaces/configuring-prebuilds#configuring-prebuilds)."
2. 如果容器需要很长时间才能生成,请考虑使用预生成来加快 codespace 创建速度。 有关详细信息,请参阅“[配置预生成](/codespaces/prebuilding-your-codespaces/configuring-prebuilds#configuring-prebuilds)”。
## Deleting codespaces
## 删除代码空间
A codespace can only be deleted by:
* The person who created the codespace.
* An organization owner for an organization-owned codespace.
* Automatic deletion at the end of a retention period.
codespace 只能通过以下方式删除:
* 创建 codespace 的人员。
* 组织拥有的 codespace 的组织所有者。
* 保留期结束时自动删除。
For more information, see "[Deleting a codespace](/codespaces/developing-in-codespaces/deleting-a-codespace)" and "[Configuring automatic deletion of your codespaces](/codespaces/customizing-your-codespace/configuring-automatic-deletion-of-your-codespaces)."
有关详细信息,请参阅“[删除 codespace](/codespaces/developing-in-codespaces/deleting-a-codespace)”和“[配置 codespace 的自动删除](/codespaces/customizing-your-codespace/configuring-automatic-deletion-of-your-codespaces)”。
## Container storage
## 容器存储
When you create a codespace, it has a finite amount of storage and over time it may be necessary for you to free up space. Try running any of the following commands in the {% data variables.product.prodname_github_codespaces %} terminal to free up storage space.
创建代码空间时,存储量是有限的,随着时间的推移,可能需要释放空间。 尝试在 {% data variables.product.prodname_github_codespaces %} 终端中运行以下任一命令以释放存储空间。
- Remove packages that are no longer used by using `sudo apt autoremove`.
- Clean the apt cache by using `sudo apt clean`.
- See the top 10 largest files in the codespace with`sudo find / -printf '%s %p\n'| sort -nr | head -10`.
- Delete unneeded files, such as build artifacts and logs.
- 使用 `sudo apt autoremove` 删除不再使用的包。
- 使用 `sudo apt clean` 清理 apt 缓存.
- 使用 `sudo find / -printf '%s %p\n'| sort -nr | head -10` 查看 codespace 中前 10 个最大的文件。
- 删除不需要的文件,如生成工件和日志。
Some more destructive options:
一些更具破坏性的选项:
- Remove unused Docker images, networks, and containers by using `docker system prune` (append `-a` if you want to remove all images, and `--volumes` if you want to remove all volumes).
- Remove untracked files from working tree: `git clean -i`.
- 使用 `docker system prune`(如果要删除所有映像,请追加 `-a`;如果要删除所有卷,请追加 `--volumes`)删除不使用的 Docker 映像、网络和容器。
- 从工作树中删除不跟踪的文件:`git clean -i`
## Configuration
## 配置
{% data reusables.codespaces.recovery-mode %}
```
This codespace is currently running in recovery mode due to a container error.
```
Review the creation logs and update the dev container configuration as needed. For more information, see "[{% data variables.product.prodname_github_codespaces %} logs](/codespaces/troubleshooting/github-codespaces-logs)."
查看创建日志并根据需要更新开发容器配置。 有关详细信息,请参阅“[{% data variables.product.prodname_github_codespaces %} 日志](/codespaces/troubleshooting/github-codespaces-logs)”。
You can then try restarting the codespace, or rebuilding the container. For more information, see "[Introduction to dev containers](/codespaces/setting-up-your-project-for-codespaces/introduction-to-dev-containers#applying-configuration-changes-to-a-codespace)."
然后,可以尝试重启 codespace或重新生成容器。 有关详细信息,请参阅“[开发容器简介](/codespaces/setting-up-your-project-for-codespaces/introduction-to-dev-containers#applying-configuration-changes-to-a-codespace)”。

View File

@@ -0,0 +1,118 @@
---
title: GitHub Codespaces 客户端故障排除
shortTitle: Codespaces clients
intro: '本文提供有关在使用用于 {% data variables.product.prodname_github_codespaces %} 的客户端时可能遇到的问题的故障排除信息。'
miniTocMaxHeadingLevel: 3
versions:
fpt: '*'
ghec: '*'
type: reference
topics:
- Codespaces
redirect_from:
- /codespaces/troubleshooting/troubleshooting-codespaces-clients
ms.openlocfilehash: 682160b3b92960487c0709fc411fc2143d18f415
ms.sourcegitcommit: e8c012864f13f9146e53fcb0699e2928c949ffa8
ms.translationtype: HT
ms.contentlocale: zh-CN
ms.lasthandoff: 11/09/2022
ms.locfileid: '148159435'
---
{% jetbrains %}
{% data reusables.codespaces.codespaces-jetbrains-beta-note %}
{% endjetbrains %}
{% webui %}
## {% data variables.product.prodname_vscode %} Web 客户端故障排除
如果在非基于 Chromium 的浏览器中使用 {% data variables.product.prodname_github_codespaces %} 时遇到问题,请尝试切换到基于 Chromium 的浏览器,例如 Google Chrome 或 Microsoft Edge。 或者,在 [`microsoft/vscode`](https://github.com/microsoft/vscode/issues?q=is%3Aissue+is%3Aopen) 存储库中通过搜索标记有浏览器名称(如 [`firefox`](https://github.com/microsoft/vscode/issues?q=is%3Aissue+is%3Aopen+label%3Afirefox) 或 [`safari`](https://github.com/Microsoft/vscode/issues?q=is%3Aopen+is%3Aissue+label%3Asafari))的问题来检查浏览器是否存在已知问题。
如果在基于 Chromium 的浏览器中使用 {% data variables.product.prodname_github_codespaces %} 时遇到问题,可在 [`microsoft/vscode`](https://github.com/microsoft/vscode/issues?q=is%3Aissue+is%3Aopen) 存储库中检查是否遇到 {% data variables.product.prodname_vscode_shortname %} 的另一个已知问题。
### 与在本地使用 {% data variables.product.prodname_vscode_shortname %} 的差异
在浏览器中使用 {% data variables.product.prodname_vscode_shortname %} Web 客户端打开 codespace 时,你会注意到与在 {% data variables.product.prodname_vscode_shortname %} 桌面应用程序的本地工作区中工作有一些差异。 例如,某些键绑定将不同或丢失,并且某些扩展的行为可能不同。 有关摘要,请参阅 {% data variables.product.prodname_vscode_shortname %} 文档中的“[已知限制和调整](https://code.visualstudio.com/docs/remote/codespaces#_known-limitations-and-adaptations)”。
可使用 [`microsoft/vscode`](https://github.com/microsoft/vscode/issues?q=is%3Aissue+is%3Aopen+codespaces) 存储库中的 {% data variables.product.prodname_vscode_shortname %} 体验检查已知问题并记录新问题。
### {% data variables.product.prodname_vscode %} Insiders
{% data variables.product.prodname_vscode %} Insiders 是 {% data variables.product.prodname_vscode_shortname %} 中最常见的版本。 它具有所有最新功能和错误修复,但偶尔也可能包含导致构建中断的新问题。
如果你使用的是 Insiders 版本并发现损坏的行为,我们建议切换到 {% data variables.product.prodname_vscode %} Stable 版,然后重试。
单击编辑器左下方的 {% octicon "gear" aria-label="The manage icon" %},然后选择“切换到稳定版本…”。如果 {% data variables.product.prodname_vscode_shortname %} Web 版本未加载或 {% octicon "gear" aria-label="The manage icon" %} 图标不可用,可将 `?vscodeChannel=stable` 追加到 codespace URL 并在该 URL 处加载 codespace 来强制切换到 {% data variables.product.prodname_vscode %} 稳定版。
如果在 {% data variables.product.prodname_vscode %} 稳定版中未修复此问题,请检查已知问题,如果需要,请在 [`microsoft/vscode`](https://github.com/microsoft/vscode/issues?q=is%3Aissue+is%3Aopen+codespaces) 存储库中记录 {% data variables.product.prodname_vscode_shortname %} 体验的新问题。
{% endwebui %}
{% vscode %}
## {% data variables.product.prodname_vscode_shortname %} 故障排除
在 {% data variables.product.prodname_vscode_shortname %} 桌面应用程序中打开 codespace 时,你可能会注意到与在本地工作区中工作相比存在一些差异,但体验应该相似。
如果遇到问题,可使用 [`microsoft/vscode`](https://github.com/microsoft/vscode/issues?q=is%3Aissue+is%3Aopen+codespaces) 存储库中的 {% data variables.product.prodname_vscode_shortname %} 体验检查已知问题并记录新问题。
### {% data variables.product.prodname_vscode %} Insiders
{% data variables.product.prodname_vscode %} Insiders 是 {% data variables.product.prodname_vscode_shortname %} 中最常见的版本。 它具有所有最新功能和错误修复,但偶尔也可能包含导致构建中断的新问题。
如果你使用的是 Insiders 版本并发现损坏的行为,我们建议切换到 {% data variables.product.prodname_vscode %} Stable 版,然后重试。
若要切换到 {% data variables.product.prodname_vscode %} 稳定版,请关闭 {% data variables.product.prodname_vscode %} Insiders 应用程序,打开 {% data variables.product.prodname_vscode %} 稳定版应用程序,然后重新打开 codespace。
如果在 {% data variables.product.prodname_vscode %} 稳定版中未修复此问题,请检查已知问题,如果需要,请在 [`microsoft/vscode`](https://github.com/microsoft/vscode/issues?q=is%3Aissue+is%3Aopen+codespaces) 存储库中记录 {% data variables.product.prodname_vscode_shortname %} 体验的新问题。
{% endvscode %}
{% jetbrains %}
## JetBrains IDE 故障排除
### 性能问题
建议使用至少具有 4 个内核的 {% data variables.product.prodname_github_codespaces %} 计算机类型来运行任何 JetBrains IDE。 有关详细信息,请参阅“[更改 codespace 的计算机类型](/codespaces/customizing-your-codespace/changing-the-machine-type-for-your-codespace)”。
如果使用的是具有 4 个或更多内核的计算机,但是在 JetBrains 中体验到的性能感觉有点缓慢,则可能需要增加最大 Java 堆大小。
建议将最大堆大小设置为 2862 MiB (3 GB) 和远程主机 RAM 的 60% 之间。
下面提供了一些指导作为初始起点,你可以根据代码库的大小和运行应用程序所需的内存进行调整。 例如,如果你有一个大型或复杂的代码库,则可能需要进一步增加堆大小。 如果应用程序较大,则可以设置较小的堆大小,以允许应用程序获得更多内存。
| 计算机类型 | 最大堆大小 |
| -------------- | ----------------- |
| 4 个内核 | 3 GB |
| 8 个内核 | 4 GB |
| 16 或 32 个内核 | 8 GB |
1. 在应用程序窗口顶部的导航栏左侧,单击 codespace 的名称。
![JetBrains 中“资源”按钮的屏幕截图](/assets/images/help/codespaces/jetbrains-resources-button.png)
1. 在“性能”选项卡中,注意 CPU 负载和内存详细信息。 这些值将指示计算机是否重载。
![JetBrains 中“Localhost”按钮的屏幕截图](/assets/images/help/codespaces/jetbrains-performance.png)
1. 单击“设置”选项卡并编辑堆大小,将其增加到不超过 codespace 可用内存的 60%。
![最大堆大小设置的屏幕截图](/assets/images/help/codespaces/jetbrains-heap-setting.png)
1. 单击“保存并重启”。
### SSH 连接问题
若要通过在 codespace 中运行的 SSH 服务器进行连接,必须在 `~/.ssh` 目录MacOS 和 Linux`%HOMEPATH%\.ssh` 目录 (Windows) 中具有已添加到 {% data variables.product.prodname_dotcom %} 帐户的 SSH 密钥。 如果此目录中没有任何密钥,{% data variables.product.prodname_cli %} 将生成密钥。 有关详细信息,请参阅“[将新的 SSH 密钥添加到 {% data variables.product.prodname_dotcom %} 帐户](/authentication/connecting-to-github-with-ssh/adding-a-new-ssh-key-to-your-github-account?platform=windows&tool=webui)”。
如果遇到密钥验证问题,请尝试升级 {% data variables.product.prodname_cli %} 的版本。 有关信息,请参阅 {% data variables.product.prodname_cli %} 的自述文件中的[升级说明](https://github.com/cli/cli#installation)。
### JetBrains IDE 问题
有关你正在使用的 JetBrains IDE 或 JetBrains 网关应用程序特定问题的帮助,请参阅 JetBrains 网站上的“[产品支持](https://www.jetbrains.com/support/)”。
{% endjetbrains %}

View File

@@ -0,0 +1,117 @@
---
title: 排查 GitHub Codespaces 的 GPG 验证问题
shortTitle: GPG verification
intro: 本文提供在 codespace 中对提交进行签名的相关错误的故障排除建议。
versions:
fpt: '*'
ghec: '*'
type: reference
topics:
- Codespaces
ms.openlocfilehash: f3a6537d1ee9087803054347689591c2b217e42e
ms.sourcegitcommit: 47e03737d09bed84dfedb7be5924d893d34ea1a8
ms.translationtype: HT
ms.contentlocale: zh-CN
ms.lasthandoff: 11/16/2022
ms.locfileid: '148167111'
---
如果启用 GPG 验证,{% data variables.product.prodname_github_codespaces %} 会自动在从所选存储库创建的 codespace 中对提交进行签名。 有关详细信息,请参阅“[管理 {% data variables.product.prodname_github_codespaces %} 的 GPG 验证](/codespaces/managing-your-codespaces/managing-gpg-verification-for-github-codespaces)”。
{% data reusables.codespaces.gpg-in-active-codespaces %}
如果 {% data variables.product.prodname_github_codespaces %} 未能对提交进行签名,你可能会看到如下所示的错误。
```Shell
$ git commit -m 'Initial commit'
error: gpg failed to sign the data
fatal: failed to write commit object
```
在以下情况下,你可能会遇到此错误:
- 你已禁用 GPG 验证,并且正在尝试在现有 codespace 中进行常规的未签名提交。
- 你已启用 GPG 验证,但重写了 {% data variables.product.prodname_github_codespaces %} 对提交进行签名所需的 Git 配置,例如,将 {% data variables.product.prodname_github_codespaces %} 链接到包含 Git 配置文件的点文件存储库。
## 禁用 GPG 验证后的错误
启用 GPG 验证后,{% data variables.product.prodname_github_codespaces %} 默认对你在 codespace 中所做的所有提交进行签名。 它执行此操作的方法是将 `commit.gpgsign` Git 配置值设置为 `true`
如果已禁用 GPG 验证,并且正在使用现有 codespace则此值仍将设置为 `true`。 这意味着 {% data variables.product.prodname_github_codespaces %} 将尝试对提交进行签名,但无法这样做,因为你已禁用 GPG 验证设置。
要在 codespace 中继续进行常规的未签名提交,请在终端中输入以下命令将 `commit.gpgsign` 重置为默认值 `false`
```Shell{:copy}
git config --unset commit.gpgsign
```
要检查是否已从配置中正确删除该值,可输入 `git config --list`。 列表中不应出现 `commit.gpgsign` 的值。
## 冲突的配置引发的错误
要自动对提交进行签名,{% data variables.product.prodname_github_codespaces %} 会在 codespace 中设置某些 Git 配置值。 如果重写 {% data variables.product.prodname_github_codespaces %} 设置的值,则可能无法对提交进行签名。
如果已将 {% data variables.product.prodname_github_codespaces %} 链接到包含 Git 配置文件的点文件存储库,则可能无意中重写了这些值。 有关将点文件与 {% data variables.product.prodname_github_codespaces %} 配合使用的详细信息,请参阅“[为帐户设置个性化的 {% data variables.product.prodname_github_codespaces %}](/codespaces/customizing-your-codespace/personalizing-github-codespaces-for-your-account#dotfiles)”。
### 检查是否存在冲突的配置
要使用 GPG 对提交进行签名,{% data variables.product.prodname_github_codespaces %} 会自动在系统级别设置以下 Git 配置值。
| 配置设置 | 所需的值 |
| --------------------- | -------------- |
| `user.name` | 必须与 {% data variables.product.prodname_dotcom %} 配置文件上设置的全名匹配 |
| `credential.helper` | 必须设置为 `/.codespaces/bin/gitcredential_github.sh` |
| `gpg.program` | 必须设置为 `/.codespaces/bin/gh-gpgsign` |
要检查是否在 codespace 中正确设置了这些值,可使用 `git config --list --show-origin` 命令。 由于 {% data variables.product.prodname_github_codespaces %} 在系统级别设置此配置,因此所需的配置设置应来自 `/usr/local/etc/gitconfig`
```Shell
$ git config --list --show-origin
file:/usr/local/etc/gitconfig credential.helper=/.codespaces/bin/gitcredential_github.sh
file:/usr/local/etc/gitconfig user.name=Mona Lisa
file:/usr/local/etc/gitconfig gpg.program=/.codespaces/bin/gh-gpgsign
```
除了上面列出的值之外,如果 codespace 中使用的点文件包含以下任何值,你可能会遇到错误。
- `user.signingkey` Git 配置值
- `commit.gpgsign` Git 配置值
- 手动设置的 `GITHUB_TOKEN`
### 删除冲突的配置
如果要为 {% data variables.product.prodname_github_codespaces %} 启用自动 GPG 验证,则需要从 codespace 中使用的点文件中删除所有冲突的配置。
例如,如果本地计算机上的全局 `.gitconfig` 文件包含 `gpg.program` 值,并且你已将此文件推送到与 {% data variables.product.prodname_github_codespaces %} 链接的点文件存储库,则可能需要从此文件中删除 `gpg.program`,并改为在本地计算机上的系统级别对其进行设置。
{% note %}
注意:对点文件存储库所做的任何更改都将应用于你创建的新 codespace但不会应用于现有的 codespace。
{% endnote %}
1. 在本地计算机上打开终端。
2. 要从 `~/.gitconfig` (Mac/Linux) 或 `C:\Users\YOUR-USER\.gitconfig` (Windows) 中删除冲突的值,请使用 `git config --global --unset` 命令。
```Shell
$ git config --global --unset gpg.program
```
3. 将更改推送到 {% data variables.product.prodname_dotcom %} 上的点文件存储库。
4. (可选)要保留本地配置,可以在 Git 配置文件中再次设置该值,但不将此设置推送到点文件存储库。
例如,可使用 `--system` 标志在 `PATH/etc/gitconfig` 中的系统级文件中设置配置,其中 `PATH` 是在系统上安装 Git 的目录。
```Shell
$ git config --system gpg.program gpg2
```
或者,如果点文件存储库在识别的文件(如 `install.sh`)中包含安装脚本,你可使用 `$CODESPACES` 环境变量添加条件逻辑,例如仅当你不在 codespace 中时设置 `gpg.program`。 在下面的示例中,如果你不在 codespace 中,`-z "$CODESPACES"` 返回 `true`
```Shell{:copy}
if [ -z "$CODESPACES" ]; then
git config --global gpg.program gpg2
fi
```
## 延伸阅读
- “[关于提交签名验证](/authentication/managing-commit-signature-verification/about-commit-signature-verification)”
- 官方 Git 文档中的 [`git config`](https://git-scm.com/docs/git-config)

View File

@@ -1,6 +1,6 @@
---
title: Troubleshooting port forwarding for GitHub Codespaces
intro: Troubleshooting steps for common port forwarding issues.
title: GitHub Codespaces 的端口转发疑难解答
intro: 常见端口转发问题的疑难解答步骤。
versions:
fpt: '*'
ghec: '*'
@@ -10,17 +10,22 @@ topics:
shortTitle: Port forwarding
redirect_from:
- /codespaces/troubleshooting/troubleshooting-port-forwarding-for-codespaces
ms.openlocfilehash: 828150ca05c18cb1106f5a3c883331785b6bce2e
ms.sourcegitcommit: e8c012864f13f9146e53fcb0699e2928c949ffa8
ms.translationtype: HT
ms.contentlocale: zh-CN
ms.lasthandoff: 11/09/2022
ms.locfileid: '148159147'
---
在 codespace 内运行的应用程序向控制台输出端口时,{% data variables.product.prodname_github_codespaces %} 将检测到 localhost URL 模式并自动转发端口。 有关详细信息,请参阅“[在 codespace 中转发端口](/codespaces/developing-in-codespaces/forwarding-ports-in-your-codespace)”。
When an application running inside a codespace outputs a port to the console, {% data variables.product.prodname_github_codespaces %} detects the localhost URL pattern and automatically forwards the port. For more information, see "[Forwarding ports in your codespace](/codespaces/developing-in-codespaces/forwarding-ports-in-your-codespace)."
如果端口未自动转发,则可以手动转发该端口。 有关详细信息,请参阅“[转发端口](/codespaces/developing-in-codespaces/forwarding-ports-in-your-codespace#forwarding-a-port)”。
If a port is not automatically forwarded, you can forward it manually. For more information, see "[Forwarding a port](/codespaces/developing-in-codespaces/forwarding-ports-in-your-codespace#forwarding-a-port)."
如果设置了端口转发,请检查以下各项:
If port forwarding is set up, check the following:
- 使用 {% data variables.product.prodname_vscode_shortname %} 右下角弹出的通知“toast”消息中的链接或单击终端中的 URL 打开转发端口。 如果通过浏览器连接到 codespace则在本地计算机上键入 `localhost:8000`(作为示例)将不起作用。
- 确保检查应用程序是否仍在代码空间中运行。 如果代码空间在一段时间不活动后停止,则需要确保在代码空间重新启动后重新启动应用程序。
- Use the link in the notification "toast" message, that pops up in the bottom right corner of {% data variables.product.prodname_vscode_shortname %}, or click the URL in Terminal, to open the forwarded port. Typing in `localhost:8000` (as an example) to your local machine will not work if you're connected to the codespace via the browser.
- Make sure to check that your application is still running from within your codespace. If your codespace has stopped after a period of inactivity, you'll need to ensure to restart your application once the codespace has restarted.
Typically, you can make a forwarded port accessible publicly, or within the organization that owns a repository. For more information, see "[Forwarding ports in your codespace](/codespaces/developing-in-codespaces/forwarding-ports-in-your-codespace)." If either, or both, of the options for public or organization visibility are not available, this indicates that an organization-level policy has been configured. For more information, see "[Restricting the visibility of forwarded ports](/codespaces/managing-codespaces-for-your-organization/restricting-the-visibility-of-forwarded-ports)."
通常,可使转发端口可公开访问,也可在拥有存储库的组织内访问。 有关详细信息,请参阅“[在 codespace 中转发端口](/codespaces/developing-in-codespaces/forwarding-ports-in-your-codespace)”。 如果公共或组织可见性选项中的任何一个或两者都不可用,则表示已配置了组织级别的策略。 有关详细信息,请参阅“[限制转发端口的可见性](/codespaces/managing-codespaces-for-your-organization/restricting-the-visibility-of-forwarded-ports)”。
{% data reusables.codespaces.forwarded-ports-environment-variable %}

View File

@@ -1,6 +1,6 @@
---
title: Troubleshooting your connection to GitHub Codespaces
intro: 'Troubleshooting help for connecting to {% data variables.product.prodname_github_codespaces %}.'
title: GitHub Codespaces 连接疑难解答
intro: '有关连接到 {% data variables.product.prodname_github_codespaces %} 的疑难解答帮助。'
versions:
fpt: '*'
ghec: '*'
@@ -10,49 +10,54 @@ topics:
shortTitle: Connection
redirect_from:
- /codespaces/troubleshooting/troubleshooting-your-connection-to-codespaces
ms.openlocfilehash: 75632e73b689ed7fe1df95027f6e5170136c7935
ms.sourcegitcommit: e8c012864f13f9146e53fcb0699e2928c949ffa8
ms.translationtype: HT
ms.contentlocale: zh-CN
ms.lasthandoff: 11/09/2022
ms.locfileid: '148159477'
---
## 503 代码空间服务不可用
## 503 codespace service unavailable
Codespaces 设置为在无任何活动 30 分钟后停止。 如果你在 codespace 停止后尝试与其交互,你可能会看到 `503 service unavailable` 错误。
Codespaces are set to stop after 30 minutes without any activity. If you try to interact with a codespace after it has stopped, you may see a `503 service unavailable` error.
- 如果 {% data variables.product.prodname_vscode %} 或浏览器窗口中显示“开始”按钮,请单击“开始”以重新连接到 codespace 。
- 通过重新加载窗口来重置代码空间。 从 {% data variables.product.prodname_vscode %} 中的[命令面板](/codespaces/codespaces-reference/using-the-command-palette-in-codespaces#accessing-the-command-palette),单击“开发人员: 重新加载窗口”。
- If a **Start** button is shown in {% data variables.product.prodname_vscode %} or in your browser window, click **Start** to reconnect to the codespace.
- Reset your codespace by reloading the window. From the [Command Palette](/codespaces/codespaces-reference/using-the-command-palette-in-codespaces#accessing-the-command-palette) in {% data variables.product.prodname_vscode %}, click **Developer: Reload Window**.
## 浏览器无法连接
## Browser cannot connect
有时,您可能无法从浏览器访问代码空间。 如果发生这种情况,请转到 https://github.com/codespaces 并尝试从该页面连接到 codespace。
Sometimes you may not be able to access a codespace from your browser. If this happens, go to https://github.com/codespaces and try connecting to the codespace from that page.
- 如果该页面上未列出代码空间,请检查您是尝试连接到的代码空间的所有者。 您只能打开自己创建的代码空间。 代码空间的 URL 始终包含 {% data variables.product.company_short %} 句柄。
- 如果列出了代码空间,但您无法从该页面进行连接,请检查是否可以使用其他浏览器进行连接。
- If the codespace is not listed on that page, check that you are the owner of the codespace you are trying to connect to. You can only open a codespace that you created. The URLs for your codespaces always include your {% data variables.product.company_short %} handle.
- If the codespace is listed but you cannot connect from that page, check whether you can connect using a different browser.
您的公司网络可能阻止连接。 如果可能,请检查设备上是否有任何被拒绝的连接的日志记录。
Your company network may be blocking the connection. If possible, check any logging for rejected connections on your device.
如果仍然无法连接,{% data reusables.codespaces.contact-support %}
If you still cannot connect, {% data reusables.codespaces.contact-support %}
## 无法连接到 JupyterLab 中的 codespace
## Unable to connect to your codespace in JupyterLab
若要在 JupyterLab 中使用 codespace必须确保 codespace 已安装 JupyterLab。 {% data variables.product.prodname_github_codespaces %} 使用的默认容器映像包括 JupyterLab但如果已自定义开发容器配置则必须手动安装 JupyterLab。
To be able to use a codespace in JupyterLab, you must ensure that your codespace has it installed. The default container image that's used by {% data variables.product.prodname_github_codespaces %} includes JupyterLab, but if you have customized your dev container configuration you will have to manually install JupyterLab.
如果 codespace 使用基于 Debian 的映像,则可以将 `python` 功能添加到 `devcontainer.json` 文件,并将 `installJupyterlab` 选项设置为 `true`,从而在开发容器中安装 JupyterLab。 否则,请直接将其安装在 Dockerfile 中。 有关安装说明,请参阅 JupyterLab 文档中的“[安装](https://jupyterlab.readthedocs.io/en/stable/getting_started/installation.html)”。
If your codespace uses a Debian-based image, you can install JupyterLab in the dev container by adding the `python` feature to your `devcontainer.json` file, with the `installJupyterlab` option set to `true`. Otherwise, install it directly in your Dockerfile. For installation instructions, see "[Installation](https://jupyterlab.readthedocs.io/en/stable/getting_started/installation.html)" in the JupyterLab documentation.
有关 `python` 功能的详细信息,请参阅[`devcontainers/features` 存储库](https://github.com/devcontainers/features/tree/main/src/python)中的自述文件页。 有关 `devcontainer.json` 文件以及 Dockerfile 的详细信息,请参阅“[开发容器简介](/codespaces/setting-up-your-project-for-codespaces/introduction-to-dev-containers#devcontainerjson)”。
For more information about the `python` feature, see the README page in the [`devcontainers/features` repository](https://github.com/devcontainers/features/tree/main/src/python). For more information about the `devcontainer.json` file and the Dockerfile, see "[Introduction to dev containers](/codespaces/setting-up-your-project-for-codespaces/introduction-to-dev-containers#devcontainerjson)."
如果仍然无法连接,{% data reusables.codespaces.contact-support %}
If you still cannot connect, {% data reusables.codespaces.contact-support %}
## {% data variables.product.prodname_vscode %} 的 {% data variables.product.prodname_github_codespaces %} 扩展无法连接
## {% data variables.product.prodname_github_codespaces %} extension for {% data variables.product.prodname_vscode %} cannot connect
如果无法从 {% data variables.product.prodname_vscode %} 桌面连接到代码空间,请使用以下故障排除步骤。
If you cannot connect to a codespace from {% data variables.product.prodname_vscode %} desktop, use the following troubleshooting steps.
1. 检查您是否安装了最新版本的 {% data variables.product.prodname_github_codespaces %} 扩展。 该扩展是预览版,并且频繁发布更新。
1. 在 {% data variables.product.prodname_vscode %} 中显示“Extensions扩展”选项卡。
2. 选择 {% data variables.product.prodname_github_codespaces %} 扩展以显示扩展的概述页面。
3. 如果有可用更新,则会显示一个按钮,单击“更新到 X.X.X”以升级到最新版本。
2. 检查你使用的是 {% data variables.product.prodname_vscode %} 稳定版本还是 [{% data variables.product.prodname_vscode %} 预览体验成员](https://code.visualstudio.com/insiders/)版本(每晚更新)。 如果使用的是预览体验成员版本,请尝试安装[稳定版本](https://code.visualstudio.com/)。
3. 您的公司网络可能阻止连接。 如果可能,请检查设备上是否有任何被拒绝的连接的日志记录。
1. Check that you have the latest version of the {% data variables.product.prodname_github_codespaces %} extension installed. The extension is a preview release and frequent updates are released.
1. In {% data variables.product.prodname_vscode %}, display the "Extensions" tab.
2. Select the {% data variables.product.prodname_github_codespaces %} extension to display the extension's overview page.
3. If an update is available, a button is shown, click **Update to X.X.X** to upgrade to the latest version.
2. Check whether you are using the stable build of {% data variables.product.prodname_vscode %} or the [{% data variables.product.prodname_vscode %} Insiders](https://code.visualstudio.com/insiders/) release (nightly updates). If you are using the insiders release, try installing the [stable build](https://code.visualstudio.com/).
3. Your company network may be blocking the connection. If possible, check any logging for rejected connections on your device.
如果仍然无法连接,{% data reusables.codespaces.contact-support %}
If you still cannot connect, {% data reusables.codespaces.contact-support %}
### 代码空间存在延迟问题
### The codespace has latency issues
If the codespace seems particularly slow or has latency issues, it is possible that it has been created in a region that is far from you. To resolve this, you can [manually set your {% data variables.product.prodname_github_codespaces %} region](/codespaces/managing-your-codespaces/setting-your-default-region-for-codespaces).
如果代码空间看起来特别慢或存在延迟问题,则可能是在远离您的区域中创建的。 要解决此问题,可以[手动设置 {% data variables.product.prodname_github_codespaces %} 区域](/codespaces/managing-your-codespaces/setting-your-default-region-for-codespaces)。

View File

@@ -1,6 +1,6 @@
---
title: Working with support for GitHub Codespaces
intro: 'Tips on getting the best help from support for {% data variables.product.prodname_github_codespaces %}.'
title: 使用对 GitHub Codespaces 的支持
intro: '有关从 {% data variables.product.prodname_github_codespaces %} 的支持中获得最佳帮助的提示。'
versions:
fpt: '*'
ghec: '*'
@@ -10,29 +10,34 @@ topics:
shortTitle: Working with support
redirect_from:
- /codespaces/troubleshooting/working-with-support-for-codespaces
ms.openlocfilehash: a4db589cb5d8de71e6e8c7d109e0156885c33848
ms.sourcegitcommit: e8c012864f13f9146e53fcb0699e2928c949ffa8
ms.translationtype: HT
ms.contentlocale: zh-CN
ms.lasthandoff: 11/09/2022
ms.locfileid: '148159434'
---
在支持人员帮助你解决 codespace 问题之前,你需要知道 codespace 的永久名称及其 codespace ID标识符。 此外,支持人员可能会要求您与他们共享一些日志。 有关详细信息,请参阅“[{% data variables.product.prodname_github_codespaces %} 日志](/codespaces/troubleshooting/github-codespaces-logs)”和“[关于 GitHub 支持](/github/working-with-github-support/about-github-support)”。
Before support can help you with problems with codespaces, you need to know the permanent name of the codespace and its codespaces ID (identifier). In addition, support may ask you to share some logs with them. For more information, see "[{% data variables.product.prodname_github_codespaces %} logs](/codespaces/troubleshooting/github-codespaces-logs)" and "[About GitHub Support](/github/working-with-github-support/about-github-support)."
## 代码空间名称
## Codespace names
每个 codespace 都有一个唯一的名称,该名称是 {% data variables.product.company_short %} 句柄、两三个自动生成的单词和一些随机字符的组合。 例如:`octocat-literate-space-parakeet-mld5`。 两个或三个自动生成的单词也构成了 codespace 的初始显示名称,在本例中为 `literate-space-parakeet`。 可以更改 codespace 的显示名称,但这不会影响永久名称。 有关详细信息,请参阅“[重命名 codespace](/codespaces/customizing-your-codespace/renaming-a-codespace)”。
Each codespace has a unique name that is a combination of your {% data variables.product.company_short %} handle, two or three automatically generated words, and some random characters. For example: `octocat-literate-space-parakeet-mld5`. The two or three automatically generated words also form the initial display name of your codespace, in this case, `literate-space-parakeet`. You can change the display name for a codespace, but this will not affect the permanent name. For more information, see "[Renaming a codespace](/codespaces/customizing-your-codespace/renaming-a-codespace)."
要查找代码空间的名称:
To find the name of a codespace:
- 在浏览器中打开代码空间。 URL 的子域是代码空间的名称。 例如:`https://octocat-literate-space-parakeet-mld5.github.dev``octocat-literate-space-parakeet-mld5` codespace 的 URL。
- 如果无法打开 codespace可以在 https://github.com/codespaces 上访问 {% data variables.product.product_name %} 中的名称。 将鼠标悬停在 https://github.com/codespaces 上的 codespace 的显示名称上时,该名称将在弹出项中显示。
![将鼠标悬停在上方时显示的 codespace 名称](/assets/images/help/codespaces/find-codespace-name-github.png)
- Open the codespace in the browser. The subdomain of the URL is the name of the codespace. For example: `https://octocat-literate-space-parakeet-mld5.github.dev` is the URL for the `octocat-literate-space-parakeet-mld5` codespace.
- If you cannot open a codespace, you can access the name in {% data variables.product.product_name %} on https://github.com/codespaces. The name is shown in a pop-up when you hover over the display name of a codespace on https://github.com/codespaces.
![Codespace name shown on hover over](/assets/images/help/codespaces/find-codespace-name-github.png)
代码空间的名称也包含在许多日志文件中。 例如,在 codespace 日志中是作为 `friendlyName` 的值;在 {% data variables.product.prodname_github_codespaces %} 扩展日志中,是位于 `making GET request for` 之后;在浏览器控制台日志中,是位于 `clientUrl` 之后。 有关详细信息,请参阅“[{% data variables.product.prodname_github_codespaces %} 日志](/codespaces/troubleshooting/github-codespaces-logs)”。
The name the codespace is also included in many of the log files. For example, in the codespace logs as the value of `friendlyName`, in the {% data variables.product.prodname_github_codespaces %} extension log after `making GET request for`, and in the browser console log after `clientUrl`. For more information, see "[{% data variables.product.prodname_github_codespaces %} logs](/codespaces/troubleshooting/github-codespaces-logs)."
## 代码空间 ID
## Codespaces IDs
每个代码空间还有一个 ID标识符。 默认情况下,这在 {% data variables.product.prodname_vscode %} 中不显示,因此您可能需要先更新 {% data variables.product.prodname_github_codespaces %} 扩展的设置,然后才能访问该 ID
Every codespace also has an ID (identifier). This is not shown by default in {% data variables.product.prodname_vscode %} so you may need to update the settings for the {% data variables.product.prodname_github_codespaces %} extension before you can access the ID.
1. In {% data variables.product.prodname_vscode %}, browser or desktop, in the Activity Bar on the left, click **Remote Explorer** to show details for the codespace.
1. 在 {% data variables.product.prodname_vscode %}、浏览器或桌面中的左侧活动栏中,单击“远程资源管理器”以显示 codespace 的详细信息。
{% indented_data_reference reusables.codespaces.remote-explorer spaces=3 %}
1. If the sidebar includes a "Codespace Performance" section, hover over the "Codespace ID" and click the clipboard icon to copy the ID.
1. If the information is not shown, click {% octicon "gear" aria-label="The gear icon" %}, in the bottom-left corner of the Activity Bar, to display the "Settings" tab.
1. Expand **Extensions** and click **{% data variables.product.prodname_github_codespaces %}** to display the settings for the extension. Then enable **Show Performance Explorer** to display the "Codespace Performance" section in the sidebar.
![Codespace ID and settings required to display performance information](/assets/images/help/codespaces/find-codespace-id.png)
1. 如果侧边栏包含“Codespace Performance代码空间性能”部分请将鼠标悬停在“Codespace ID代码空间 ID”上然后单击剪贴板图标以复制 ID
1. 如果未显示信息,请单击活动栏左下角的 {% octicon "gear" aria-label="The gear icon" %} 以显示“Settings设置”选项卡。
1. 展开“扩展”,然后单击“{% data variables.product.prodname_github_codespaces %}”以显示扩展的设置 。 然后启用“显示性能资源管理器”在边栏中显示“codespace 性能”部分。
![显示性能信息所需的 codespace ID 和设置](/assets/images/help/codespaces/find-codespace-id.png)

View File

@@ -1,6 +1,6 @@
---
title: About GitHub Global Campus for students
intro: '{% data variables.product.prodname_education %} offers students real-world experience with free access to various developer tools from {% data variables.product.prodname_dotcom %}''s partners.'
title: 关于学生版 GitHub Global Campus
intro: '{% data variables.product.prodname_education %} 让学生免费使用 {% data variables.product.prodname_dotcom %} 合作伙伴的各种开发工具,为他们提供真实的体验。'
redirect_from:
- /education/teach-and-learn-with-github-education/about-github-education-for-students
- /github/teaching-and-learning-with-github-education/about-github-education-for-students
@@ -10,40 +10,46 @@ redirect_from:
versions:
fpt: '*'
shortTitle: For students
ms.openlocfilehash: 198f0354e63721a4763e8fa32f832a19b2dac9d9
ms.sourcegitcommit: 3abdbdbb47a9319f20e11845e9c2d8a7fce63422
ms.translationtype: HT
ms.contentlocale: zh-CN
ms.lasthandoff: 11/15/2022
ms.locfileid: '148165095'
---
Using {% data variables.product.prodname_dotcom %} for your school projects is a practical way to collaborate with others and build a portfolio that showcases real-world experience.
{% data variables.product.prodname_dotcom %} 用于学校项目是一种与别人协作的实用方式,可创建展示真实世界的作品集。
Everyone with a {% data variables.product.prodname_dotcom %} account can collaborate in unlimited public and private repositories with {% data variables.product.prodname_free_user %}. As a student, you can also apply for {% data variables.product.prodname_education %} student benefits. Your {% data variables.product.prodname_education %} student benefits and resources are all included in {% data variables.product.prodname_global_campus %}, a portal that allows you to access your education benefits, all in one place. For more information, see "[Apply to GitHub Global Campus as a student](/education/explore-the-benefits-of-teaching-and-learning-with-github-education/github-global-campus-for-students/apply-to-github-global-campus-as-a-student)" and [{% data variables.product.prodname_education %}](https://education.github.com/).
拥有 {% data variables.product.prodname_dotcom %} 帐户的每个人都可通过 {% data variables.product.prodname_free_user %} 在无限的公共和私有仓库中协作。 作为学生,还可以申请 {% data variables.product.prodname_education %} 学生权益。 {% data variables.product.prodname_education %} 学生权益和资源均包含在 {% data variables.product.prodname_global_campus %} 中,这是一个可访问教育权益的一站式门户。 有关详细信息,请参阅“[以学生身份申请加入 GitHub Global Campus](/education/explore-the-benefits-of-teaching-and-learning-with-github-education/github-global-campus-for-students/apply-to-github-global-campus-as-a-student)”和 [{% data variables.product.prodname_education %}](https://education.github.com/)
Before applying for Global Campus, check if your learning community is already partnered with us as a {% data variables.product.prodname_campus_program %} school. For more information, see "[About {% data variables.product.prodname_campus_program %}](/education/explore-the-benefits-of-teaching-and-learning-with-github-education/about-github-campus-program)."
在申请 Global Campus 之前,请检查你的学习社区是否已作为 {% data variables.product.prodname_campus_program %} 学校与我们合作。 有关详细信息,请参阅“[关于 {% data variables.product.prodname_campus_program %}](/education/explore-the-benefits-of-teaching-and-learning-with-github-education/about-github-campus-program)”。
If you're a member of a school club, a teacher can apply for {% data variables.product.prodname_global_campus %} so your team can collaborate using {% data variables.product.prodname_team %}, which allows unlimited users and private repositories, for free. For more information, see "[Apply to {% data variables.product.prodname_global_campus %} as a teacher](/education/explore-the-benefits-of-teaching-and-learning-with-github-education/github-global-campus-for-teachers/apply-to-github-global-campus-as-a-teacher)."
如果你是学校俱乐部的成员,教师可以申请 {% data variables.product.prodname_global_campus %},这样你的团队可以免费使用 {% data variables.product.prodname_team %}(允许无限的用户和专用存储库)进行协作。 有关详细信息,请参阅“[以教师身份申请加入 {% data variables.product.prodname_global_campus %}](/education/explore-the-benefits-of-teaching-and-learning-with-github-education/github-global-campus-for-teachers/apply-to-github-global-campus-as-a-teacher)”。
Once you are a verified {% data variables.product.prodname_global_campus %} student, you can access {% data variables.product.prodname_global_campus %} anytime by going to the [{% data variables.product.prodname_education %} website](https://education.github.com).
当你成为经过验证的 {% data variables.product.prodname_global_campus %} 学生后,可随时转到 [{% data variables.product.prodname_education %} 网站](https://education.github.com)来访问 {% data variables.product.prodname_global_campus %}。
![{% data variables.product.prodname_global_campus %} portal for students](/assets/images/help/education/global-campus-portal-students.png)
![学生版 {% data variables.product.prodname_global_campus %} 门户](/assets/images/help/education/global-campus-portal-students.png)
## {% data variables.product.prodname_global_campus %} features for students
## 学生版 {% data variables.product.prodname_global_campus %} 功能
{% data variables.product.prodname_global_campus %} is a portal from which you can access your {% data variables.product.prodname_education %} benefits and resources, all in one place. On the {% data variables.product.prodname_global_campus %} portal, students can:
- Connect with a local Campus Expert. For more information on campus experts, see "[About Campus Experts](/education/explore-the-benefits-of-teaching-and-learning-with-github-education/use-github-at-your-educational-institution/about-campus-experts)."
- Explore and claim offers for free industry tools from the [Student Developer Pack](https://education.github.com/pack).
- See upcoming in-person and virtual events for students, curated by {% data variables.product.prodname_education %} and student leaders.
- View assignments from [GitHub Classroom](https://classroom.github.com/) with upcoming due dates.
- Stay in the know on what the community is interested in by rewatching recent [Campus TV](https://www.twitch.tv/githubeducation) episodes. Campus TV is created by {% data variables.product.prodname_dotcom %} and student community leaders and can be watched live or on demand.
- Discover student-created repositories from GitHub Community Exchange. For more information, see "[About GitHub Community Exchange](/education/explore-the-benefits-of-teaching-and-learning-with-github-education/github-global-campus-for-students/about-github-community-exchange)."
{% data variables.product.prodname_global_campus %} 是一个一站式门户,你可从中访问 {% data variables.product.prodname_education %} 权益和资源。 在 {% data variables.product.prodname_global_campus %} 门户上,学生可以执行以下操作:
- 与本地校园专家联系。 有关校园专家的详细信息,请参阅“[关于校园专家](/education/explore-the-benefits-of-teaching-and-learning-with-github-education/use-github-at-your-educational-institution/about-campus-experts)”。
- 探索并申请[学生开发人员包](https://education.github.com/pack)中免费行业工具的优惠。
- 查看由 {% data variables.product.prodname_education %} 和学生领袖策划的现场活动和虚拟活动。
- 查看 [GitHub Classroom](https://classroom.github.com/) 中临近截止日期的作业。
- 重新观看最近的 [Campus TV](https://www.twitch.tv/githubeducation) 剧集,了解社区对什么感兴趣。 Campus TV 由 {% data variables.product.prodname_dotcom %} 和学生社区领袖创建,可观看直播或按需观看。
- 从 GitHub Community Exchange 发现学生创建的存储库。 有关详细信息,请参阅“[关于 GitHub Community Exchange](/education/explore-the-benefits-of-teaching-and-learning-with-github-education/github-global-campus-for-students/about-github-community-exchange)”。
{% data variables.product.prodname_global_campus %} students also receive the following {% data variables.product.prodname_dotcom %} benefits.
- **{% data variables.product.prodname_copilot %}**: Verified students receive a free subscription for {% data variables.product.prodname_copilot %}. You will be automatically notified about the free subscription when you visit the {% data variables.product.prodname_copilot %} subscription page in your account settings. For more information about subscribing to and using {% data variables.product.prodname_copilot %}, see "[Managing your {% data variables.product.prodname_copilot %} subscription](/billing/managing-billing-for-github-copilot/managing-your-github-copilot-subscription#setting-up-a-trial-of-github-copilot)" and "[About {% data variables.product.prodname_copilot %}](/copilot/overview-of-github-copilot/about-github-copilot)."
- **{% data variables.product.prodname_github_codespaces %}**: {% data reusables.education.student-codespaces-benefit %} For more information on getting started with {% data variables.product.prodname_github_codespaces %}, see "[{% data variables.product.prodname_github_codespaces %} overview](/codespaces/overview)."
{% data variables.product.prodname_global_campus %} 学生还可获得以下 {% data variables.product.prodname_dotcom %} 权益。
- **{% data variables.product.prodname_copilot %}** :通过验证的学生可免费订阅 {% data variables.product.prodname_copilot %}。 在帐户设置中访问 {% data variables.product.prodname_copilot %} 订阅页时,将自动收到有关免费订阅的通知。 有关订阅和使用 {% data variables.product.prodname_copilot %} 的详细信息,请参阅“[管理 {% data variables.product.prodname_copilot %} 订阅](/billing/managing-billing-for-github-copilot/managing-your-github-copilot-subscription#setting-up-a-trial-of-github-copilot)”和“[关于 {% data variables.product.prodname_copilot %}](/copilot/overview-of-github-copilot/about-github-copilot)”。
- **{% data variables.product.prodname_github_codespaces %}** {% data reusables.education.student-codespaces-benefit %} 有关 {% data variables.product.prodname_github_codespaces %} 入门信息,请参阅“[{% data variables.product.prodname_github_codespaces %} 概述](/codespaces/overview)”。
{% note %}
**Note:** {% data reusables.education.note-on-student-codespaces-usage %} For more information, see "[Using {% data variables.product.prodname_github_codespaces %} with {% data variables.product.prodname_classroom %}](/education/manage-coursework-with-github-classroom/integrate-github-classroom-with-an-ide/using-github-codespaces-with-github-classroom)."
注意:{% data reusables.education.note-on-student-codespaces-usage %} 有关详细信息,请参阅“[ {% data variables.product.prodname_classroom %} 中使用 {% data variables.product.prodname_github_codespaces %}](/education/manage-coursework-with-github-classroom/integrate-github-classroom-with-an-ide/using-github-codespaces-with-github-classroom)”。
{% endnote %}
## Further reading
## 延伸阅读
- "[About {% data variables.product.prodname_global_campus %} for teachers](/education/explore-the-benefits-of-teaching-and-learning-with-github-education/github-global-campus-for-teachers/about-github-global-campus-for-teachers)"
- "[About {% data variables.product.prodname_community_exchange %}](/education/explore-the-benefits-of-teaching-and-learning-with-github-education/github-global-campus-for-students/about-github-community-exchange)"
- [关于教师版 {% data variables.product.prodname_global_campus %}](/education/explore-the-benefits-of-teaching-and-learning-with-github-education/github-global-campus-for-teachers/about-github-global-campus-for-teachers)
- [关于 {% data variables.product.prodname_community_exchange %}](/education/explore-the-benefits-of-teaching-and-learning-with-github-education/github-global-campus-for-students/about-github-community-exchange)

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