I'm working on several gcloud projects and I'm tired of having to type out --project XYZ every time I need to call a command, or worse having the command execute on the wrong project if I forget to add that in.
gcloud: is it possible to change the default project based on the current folder?
627 Views Asked by pandasEverywhere At
1
There are 1 best solutions below
Related Questions in BASH
- How do I recursively find and replace only in files named index.php on Linux webserver?
- Delete the extra space after special character in all the lines of text file
- Calling a python function with options from shell script
- bc: prevent "divide by zero" runtime error on multiple operations
- Multiple commands with find and xargs, also accounting for special characters
- How to split a directory into parts without compressing or archiving?
- concat a lot of files to stdout
- Honoring quotes while reading shell arguments from a file
- No laravel sync folders in homestead vagrant on windows
- Grouping commands in curly braces and piping does not preserve variable
- SWI Prolog pass a goal with non-zero arity through the command line arguments
- Evaluating condition of if statement in awk using a second file
- How to customise bash completion to pick only a custom set of commands?
- Bash regular expression execution hangs on long expressions
- Bitwise OR in bash arguments with square brackets
Related Questions in CONFIG
- R CMD recognize only some commands
- Save the state of a dynamic windows form application C#
- Where to save a gem config file?
- C# Spring context dictionary expression as a key
- disabling CONFIG_NET_DMA
- Java (Bukkit) how to acces to the Config with out this?
- How can I get the "realm" value of a SVN repository?
- Solr custom UpdateRequestProcessorFactory fails with "Error Instantiating UpdateRequestProcessorFactory"
- How do I organize input global variables?
- Why does Magento core override not register until third request?
- How to parse multi line value from config file
- Visual Studio: common and customized part in configuration file
- Provider dependancy not working in Config AngularJS
- How should I handle secret tokens for open source android projects?
- com.typesafe.config.ConfigException$Missing: No configuration setting found for key 'play'
Related Questions in GCLOUD
- How to ban traffic from a specific zone in Google Cloud Compute instance?
- gcloud preview app deploy returns 400 error
- Google cloud SDK code to execute via cron
- Google HTTP load balancing enforce HTTPS
- google cloud sdk: set environment variable_ python --> linux
- ERROR: (gcloud.preview) Invalid choice: 'docker'. Did you mean 'dm-v2'?
- Creating Google Cloud Platform Projects without Console page.
- How to deploy a Sails.js project on Google cloud?
- Allowing users to connect with SSH without having sudo access?
- Google Cloud VM creates new version on deploy
- gcloud command not found - while installing Google Cloud SDK
- Can't SSH to GCloud after editing /etc/network/interfaces
- How to use gcloud commands programmatically via Python
- gcloud command not found -installing Google Cloud SDK
- Why isn't gcloud available to /usr/bin/sh on Google Compute Engine instances?
Related Questions in DIRENV
- understand linux shell hooks as used by direnv
- How do I execute commands serially inside a shell script?
- Why am I no more able to change the environment variable $USERNAME on macOS?
- activating virtualenv with direnv doesn't activate virtualenv
- Can not get asdf-direnv work in docker when building
- asdf errors when starting Linux shell
- Is make installed with xcode?
- docker-compose .env vs direnv .envrc
- Terraform init: Error: failed to open temporary file with direnv
- How to automatically activate virtualenvs when cd'ing into a directory
- Direnv not allowing me to allow
- use direnv then the gopls error said can't import fmt
- Unable to override PS1 with direnv
- Why is direnv failing to read my zsh/fish/elvish/tcsh script?
- How can I install GRPCIO on an Apple M1 Silicon laptop?
Trending Questions
- UIImageView Frame Doesn't Reflect Constraints
- Is it possible to use adb commands to click on a view by finding its ID?
- How to create a new web character symbol recognizable by html/javascript?
- Why isn't my CSS3 animation smooth in Google Chrome (but very smooth on other browsers)?
- Heap Gives Page Fault
- Connect ffmpeg to Visual Studio 2008
- Both Object- and ValueAnimator jumps when Duration is set above API LvL 24
- How to avoid default initialization of objects in std::vector?
- second argument of the command line arguments in a format other than char** argv or char* argv[]
- How to improve efficiency of algorithm which generates next lexicographic permutation?
- Navigating to the another actvity app getting crash in android
- How to read the particular message format in android and store in sqlite database?
- Resetting inventory status after order is cancelled
- Efficiently compute powers of X in SSE/AVX
- Insert into an external database using ajax and php : POST 500 (Internal Server Error)
Popular Questions
- How do I undo the most recent local commits in Git?
- How can I remove a specific item from an array in JavaScript?
- How do I delete a Git branch locally and remotely?
- Find all files containing a specific text (string) on Linux?
- How do I revert a Git repository to a previous commit?
- How do I create an HTML button that acts like a link?
- How do I check out a remote Git branch?
- How do I force "git pull" to overwrite local files?
- How do I list all files of a directory?
- How to check whether a string contains a substring in JavaScript?
- How do I redirect to another webpage?
- How can I iterate over rows in a Pandas DataFrame?
- How do I convert a String to an int in Java?
- Does Python have a string 'contains' substring method?
- How do I check if a string contains a specific word?
Yes, by using gcloud configurations together with direnv.
Create a configuration (this will also activate it):
gcloud config configurations create <cool_new_config>gcloud config set project <project>Install
direnv. Hook it into your shell. With bash I used~/.bash_profileinstead of directed~/.bashrc.Navigate to the project folder where you want the switch to occur.
export CLOUDSDK_ACTIVE_CONFIG_NAME=<cool_new_config>direnv allowVerify functionality:
gcloud config configurations listOptional: rebuild the rest of the configuration
gcloud config configurations listgcloud config configurations describe <default>gcloud auth logingcloud config set compute/region <us-central1>gcloud config set compute/zone <us-central1-a>