{"id":43689368,"url":"https://github.com/jhanley-com/google-cloud-shell-cli-go","last_synced_at":"2026-02-05T03:07:09.448Z","repository":{"id":64299034,"uuid":"194457290","full_name":"jhanley-com/google-cloud-shell-cli-go","owner":"jhanley-com","description":"Repository for my article on Google Cloud Shell CLI in Go","archived":false,"fork":false,"pushed_at":"2021-12-28T23:37:54.000Z","size":40,"stargazers_count":12,"open_issues_count":1,"forks_count":4,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-06-20T12:07:23.779Z","etag":null,"topics":["golang","google-cloud-platform","google-cloud-shell"],"latest_commit_sha":null,"homepage":null,"language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jhanley-com.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-06-29T23:40:03.000Z","updated_at":"2024-05-12T17:38:20.000Z","dependencies_parsed_at":"2023-01-15T09:15:23.921Z","dependency_job_id":null,"html_url":"https://github.com/jhanley-com/google-cloud-shell-cli-go","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/jhanley-com/google-cloud-shell-cli-go","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jhanley-com%2Fgoogle-cloud-shell-cli-go","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jhanley-com%2Fgoogle-cloud-shell-cli-go/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jhanley-com%2Fgoogle-cloud-shell-cli-go/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jhanley-com%2Fgoogle-cloud-shell-cli-go/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jhanley-com","download_url":"https://codeload.github.com/jhanley-com/google-cloud-shell-cli-go/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jhanley-com%2Fgoogle-cloud-shell-cli-go/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29108417,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-05T02:48:39.389Z","status":"ssl_error","status_checked_at":"2026-02-05T02:48:27.400Z","response_time":65,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["golang","google-cloud-platform","google-cloud-shell"],"created_at":"2026-02-05T03:07:08.841Z","updated_at":"2026-02-05T03:07:09.441Z","avatar_url":"https://github.com/jhanley-com.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# google-cloud-shell-cli-go\nRepository for my article on Google Cloud Shell CLI in Go\n\nhttps://www.jhanley.com\n\nThis program requires Google OAuth 2.0 Client Credentials. Go to the Google Cloud Console -\u003e APIs \u0026 Services. Select Create credentials -\u003e OAuth Client ID. Select \"Other\" for the Application Type.\n\nOnce you have OAuth 2.0 Client Credentials, edit the the file config.json to specify the full path to the credentials file.\n\nThe first time you execute this program, you will be prompted to authenticate with Google. These credentials are saved in the file user_credentials.json. In the module auth.go, I show how to store credentials and refresh the access token.\n\nNotes:\n1) This program supports Windows.\n2) This program supports Linux with a Desktop to launch a browser.\n3) This program supports Linux without a Desktop, such as WSL, and supports manual authentication.\n\n#### I have not ported this program to Mac OS or any other platforms. Volunteers?\n\n\u003cpre\u003e\nUsage: cloudshell [command]\n  cloudshell                            - display cloudshell program help\n  cloudshell info                       - display Cloud Shell information\n  cloudshell putty                      - connect to Cloud Shell with Putty\n  cloudshell ssh                        - connect to Cloud Shell with SSH\n  cloudshell winssh                     - connect to Cloud Shell with Windows OpenSSH\n  cloudshell winscp                     - connect to Cloud Shell with Windows WinSCP\n  cloudshell bitvise                    - connect to Cloud Shell with Windows Bitvise\n  cloudshell exec \"command\"             - Execute remote command on Cloud Shell\n  cloudshell upload src_file dst_file   - Upload local file to Cloud Shell\n  cloudshell download src_file dst_file - Download from Cloud Shell to local file\n  cloudshell benchmark download         - Benchmark download speed from Cloud Shell\n  cloudshell benchmark upload           - Benchmark upload speed from Cloud Shell\n\n--debug - Turn on debug output\n--adc  -  Use Application Default Credentials - Compute Engine only\n--auth  - (re)Authenticate ignoring user_credentials.json\n--login - Specify an email address as a login hint\n\n\u003c/pre\u003e\n\n# Getting Started\n\nThis program supports Putty for the SSH client. Download https://www.putty.org/\n\nYou will need to setup the SSH keys for Cloud Shell. This requires the \"alpha\" version of the Google Cloud SDK.\n\nRun these commands in an \"Elevated Command Prompt\":\n\n1) Install the alpha components: \u003ccode\u003egcloud components install alpha\u003c/code\u003e\n2) Install the beta components: \u003ccode\u003egcloud components install beta\u003c/code\u003e\n3) Update the Google Cloud SDK: \u003ccode\u003egcloud components update\u003c/code\u003e\n\nExit the Elevated Command Prompt after updating the Cloud SDK.\n\nCreate the SSH key pairs if they do not exist. This command will check and if necessary create the key pairs and install the public key into your Cloud Shell instance.\n\n\u003ccode\u003egcloud alpha cloud-shell ssh --dry-run\u003c/code\u003e\n\nInstall the Go dependencies:\n\u003cpre\u003e\ngo get github.com/kirinlabs/HttpRequest\ngo get github.com/pkg/sftp\ngo get golang.org/x/crypto/ssh\ngo get golang.org/x/oauth2/google\n\u003c/pre\u003e\n\nBuild the program:\n\u003cpre\u003e\ngo build -o cloudshell.exe\n\u003c/pre\u003e\n\n## Examples\nRun the program and display information about your Google Cloud Shell instance:\n\u003cpre\u003e\ncloudshell info\n\u003c/pre\u003e\n\nLaunch Putty and connect to Cloud Shell:\n\u003cpre\u003e\ncloudshell putty\n\u003c/pre\u003e\n\nLaunch Windows 10 SSH and connect to Cloud Shell:\n\u003cpre\u003e\ncloudshell ssh\n\u003c/pre\u003e\n\nLaunch Linux SSH and connect to Cloud Shell:\n\u003cpre\u003e\ncloudshell ssh\n\u003c/pre\u003e\n\nUpload a file to Cloud Shell:\nThe local file \"local_file.txt\" will be copied to the current working directory in Google Cloud Shell.\n\u003cpre\u003e\ncloudshell upload local_file.txt remote_file.txt\n\u003c/pre\u003e\n\nQuick file copy:\nThis command copies the local file \"myfile.txt\" to the Cloud Shell default working directory with the same file name.\n\u003cpre\u003e\ncloudshell upload myfile.txt\n\u003c/pre\u003e\n\nCopy a file to a specic location:\n\u003cpre\u003e\ncloudshell upload local_file.txt /tmp/remote_file.txt\n\u003c/pre\u003e\n\nWhat is the current Cloud Shell working directory?\n\u003cpre\u003e\ncloudshell exec \"pwd\"\n\u003c/pre\u003e\n\nDisplay the Cloud Shell current working directory files (directory listing):\n\u003cpre\u003e\ncloudshell exec \"ls -l\"\n\u003c/pre\u003e\n\n#### Note: The remote command must be enclosed in quotation marks\nRemote commands that change the environment work but have no effect on the next command. You can combine commands in one session: \u003ccode\u003ecloudshell exec \"cd /home; cat testfile.txt\"\u003c/code\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjhanley-com%2Fgoogle-cloud-shell-cli-go","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjhanley-com%2Fgoogle-cloud-shell-cli-go","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjhanley-com%2Fgoogle-cloud-shell-cli-go/lists"}