可以使用echo
和管道它的輸入傳遞到gsutil
。
請記住爲什麼gsutil
命令不接受命令行參數 - 命令存儲在shell的歷史文件中,並且如果它們包含這些祕密作爲命令行參數,則很容易泄漏您的祕密。
因此,以下命令將存儲在shell歷史記錄中(除非以其他方式阻止它)並可能包含您的祕密。
$ echo -e "$ACCESS_KEY_ID\n$ACCESS_KEY_SECRET\n" | gsutil config -a
This command will configure HMAC credentials, but gsutil will use
OAuth2 credentials from the Cloud SDK by default. To make sure the
HMAC credentials are used, run: "gcloud config set
pass_credentials_to_gsutil false".
This command will create a boto config file at /Users/tuxdude/.boto
containing your credentials, based on your responses to the following
questions.
Boto config file "/Users/tuxdude/.boto" created. If you need to use a
proxy to access the Internet please see the instructions in that file.
What is your google access key ID? What is your google secret access key?
非常感謝你的幫助我很欣賞它 – montatich