[[["易于理解","easyToUnderstand","thumb-up"],["解决了我的问题","solvedMyProblem","thumb-up"],["其他","otherUp","thumb-up"]],[["没有我需要的信息","missingTheInformationINeed","thumb-down"],["太复杂/步骤太多","tooComplicatedTooManySteps","thumb-down"],["内容需要更新","outOfDate","thumb-down"],["翻译问题","translationIssue","thumb-down"],["示例/代码问题","samplesCodeIssue","thumb-down"],["其他","otherDown","thumb-down"]],["最后更新时间 (UTC):2025-08-18。"],[[["\u003cp\u003eGoogle Cloud CLI configurations allow users to set default properties, streamlining the use of \u003ccode\u003egcloud\u003c/code\u003e commands by eliminating the need to repeatedly specify values.\u003c/p\u003e\n"],["\u003cp\u003eUsers can set default values for project, repository, and repository location within the active \u003ccode\u003egcloud\u003c/code\u003e configuration, which can be overridden when using the \u003ccode\u003e--project\u003c/code\u003e, \u003ccode\u003e--repository\u003c/code\u003e, or \u003ccode\u003e--location\u003c/code\u003e flags in a command.\u003c/p\u003e\n"],["\u003cp\u003eDefault settings for project apply to all \u003ccode\u003egcloud\u003c/code\u003e commands that support the \u003ccode\u003e--project\u003c/code\u003e flag, while repository and location defaults are specific to Artifact Registry commands.\u003c/p\u003e\n"],["\u003cp\u003eDefault values can be unset using the \u003ccode\u003egcloud config unset\u003c/code\u003e command followed by the property name, requiring users to then specify that property in future commands.\u003c/p\u003e\n"],["\u003cp\u003eSetting defaults is most effective when using standard repository mode or consistently working within one location.\u003c/p\u003e\n"]]],[],null,["# Set defaults for gcloud commands\n\nIn the Google Cloud CLI, configurations enable you to set properties that\naffect the behavior of the active `gcloud` session. A `default` configuration is\ncreated when you initialize Google Cloud CLI and you can create other named\nconfigurations.\n\nA configuration can include default values for specific properties so that you\ndo not need to specify them in your commands.\n\nFor more information about using configurations, see the\n[gcloud config](/sdk/gcloud/reference/config) documentation.\n\nSetting defaults\n----------------\n\nYou can set a default project, repository, and repository location in the\nGoogle Cloud CLI active configuration so that you don't need to include them\nin commands where those values are required.\n\nIf you do specify a value for a project, repository, or repository location,\nthat value overrides the configured default. You can do this with the\n`--repository` or `--location` flag in your command.\n\nIf you're using repository modes other than standard mode, or frequently using repositories in different locations, setting default values might not be helpful.\n\n### Setting a default project\n\n| **Note:** When you set a default project, the setting applies to all `gcloud` commands that include a `--project` flag. The default repository and repository location settings are specific to Artifact Registry commands.\n\nTo set default project for all `gcloud` commands, run the command: \n\n gcloud config set project \u003cvar translate=\"no\"\u003ePROJECT\u003c/var\u003e\n\nReplace \u003cvar translate=\"no\"\u003ePROJECT\u003c/var\u003e with the ID of the project or fully qualified\nidentifier for the project.\n\nTo override the default, use the `--project` flag in your command. For example \n\n gcloud artifacts packages list --project=my-project\n\n### Setting a default repository\n\nTo set a default repository, run the command: \n\n gcloud config set artifacts/repository \u003cvar translate=\"no\"\u003eREPOSITORY\u003c/var\u003e\n\nReplace \u003cvar translate=\"no\"\u003eREPOSITORY\u003c/var\u003e with the name of the repository, or fully\nqualified identifier for the repository.\n\nTo override the default, use the `--repository` flag in your command. For example \n\n gcloud artifacts packages list --repository=my-repo\n\n### Setting a default location\n\nTo set a default repository location, run the command: \n\n gcloud config set artifacts/location \u003cvar translate=\"no\"\u003eLOCATION\u003c/var\u003e\n\n\nReplace \u003cvar translate=\"no\"\u003e\u003ccode translate=\"no\" dir=\"ltr\"\u003eLOCATION\u003c/code\u003e\u003c/var\u003e with the regional or multi-regional\n[location](/artifact-registry/docs/repo-locations) of the repository.\n\nTo view a list of supported locations, run the command: \n\n gcloud artifacts locations list\n\nTo override the default, use the `--location` flag in your command. For example \n\n gcloud artifacts packages list --repository=my-repo --location=us-central1\n\nRemoving default values\n-----------------------\n\nWhen you remove a default value for a configuration property, you must specify\nit in `gcloud` commands that require the property.\n\nTo unset the default project run the following command: \n\n gcloud config unset project\n\nTo unset the default repository, run the following command: \n\n gcloud config unset artifacts/repository\n\nTo unset the default location, run the following command: \n\n gcloud config unset artifacts/location"]]