LoginSignup
0
1

More than 3 years have passed since last update.

【GCP】mac OSでgcloudコマンドを再び使えるようにする。

Last updated at Posted at 2020-09-14

前提

  • 既にGCPにプロジェクトがある。
  • 一度はgcloudコマンドをローカルで使っていて、再度その設定を行う。

1. install

./google-cloud-sdk/install.sh

% ./google-cloud-sdk/install.sh
Welcome to the Google Cloud SDK!

To help improve the quality of this product, we collect anonymized usage data
and anonymized stacktraces when crashes are encountered; additional information
is available at <https://cloud.google.com/sdk/usage-statistics>. This data is
handled in accordance with our privacy policy
<https://policies.google.com/privacy>. You may choose to opt in this
collection now (by choosing 'Y' at the below prompt), or at any time in the
future by running the following command:

    gcloud config set disable_usage_reporting false

Do you want to help improve the Google Cloud SDK (y/N)?  y


This will install all the core command line tools necessary for working with
the Google Cloud Platform.


All components are up to date.

Modify profile to update your $PATH and enable shell command
completion?

Do you want to continue (Y/n)?  y

The Google Cloud SDK installer will now prompt you to update an rc
file to bring the Google Cloud CLIs into your environment.

Enter a path to an rc file to update, or leave blank to use
[/Users/kuraya/.zshrc]:
Backing up [/Users/kuraya/.zshrc] to [/Users/kuraya/.zshrc.backup].
[/Users/kuraya/.zshrc] has been updated.

==> Start a new shell for the changes to take effect.


For more information on how to get started, please visit:
  https://cloud.google.com/sdk/docs/quickstarts

ここでターミナルを起動しなおします。

2. SDKの初期化

gcloud init

Pick configuration to use:
 [1] Re-initialize this configuration [xxx] with new settings
 [2] Create a new configuration
 [3] Switch to and re-initialize existing configuration: [default]
Please enter your numeric choice:  1
Choose the account you would like to use to perform operations for
this configuration:
 [1] a*****ya@gmail.com
 [2] Log in with a new account
Please enter your numeric choice:  1

ここでは、対象のprojectを選択します。

Pick cloud project to use:
 [1] XXXXXX
 [2] YYYYYY
 [3] select-client
 [4] word-press-mmm
 [5] Create a new project
Please enter numeric choice or text value (must exactly match list
item):  2

以上です。

参考:
https://cloud.google.com/sdk/docs/quickstart-macos?hl=ja

0
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
1