switching-org

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Steps

步骤

  1. Identify the org: the user provides a username or alias (
    orgIdentifier
    ). If not provided, run
    sf org list
    to show authenticated orgs and ask the user which one to use.
  2. Set the default org:
    • Local (default):
      sf config set target-org <orgIdentifier>
      • Applies only within the current project directory. Use this for normal project work.
    • Global (only if user explicitly requests):
      sf config set target-org <orgIdentifier> --global
      • Applies system-wide across all directories. Use when working outside a project or when the user asks for global scope.
    • If this fails, report the error and suggest running
      sf org login web
      if the org may not be authorized.
  3. Verify:
    • sf config get target-org --json
    • Note: the JSON output does not include a scope/location field — it cannot confirm whether the value is local or global. Confirm the value only, e.g.:
      target-org is now set to: <value>
    • If it fails, report the error and advise running
      sf config get target-org
      .
  1. 识别组织:用户提供用户名或别名(
    orgIdentifier
    )。如果未提供,运行
    sf org list
    以显示已认证的组织,并询问用户要使用哪一个。
  2. 设置默认组织:
    • 本地(默认):
      sf config set target-org <orgIdentifier>
      • 仅适用于当前项目目录。用于常规项目工作。
    • 全局(仅当用户明确要求时):
      sf config set target-org <orgIdentifier> --global
      • 适用于系统范围内的所有目录。在项目外工作或用户要求全局范围时使用。
    • 如果操作失败,报告错误并建议如果组织可能未授权,运行
      sf org login web
  3. 验证:
    • sf config get target-org --json
    • 注意:JSON输出不包含范围/位置字段——无法确认该值是本地还是全局。仅确认值,例如:
      target-org is now set to: <value>
    • 如果验证失败,报告错误并建议运行
      sf config get target-org

Notes

注意事项