I am using GCE, I want to install Scala on Google Cloud Shell, so I first install the brew, however when I added the brew path to bash_profile, I did a mistake.

First of All, I downloaded the brew. Then I wanted to add bew path so I created a bash_profile under the root using vi ~/.bash_profile Then I wrote the following lines in that file:

export PATH="/home/linuxbrew/.linuxbrew/bin:$PATH"
source ~/.bash_profile

Now, I know I need to type "source ~/.bash_profile" in prompt not in the bash_profile. But at that time I didn't notice that, and I saved the file, after that, I can no longer open the google cloud shell, it always shows the following infor:

It said that Cloud Shell session closed before the initial prompt displayed, I can only access could shell in safe mode, cannot access the normal could shell using the button enter image description here, does anyone have ideas about how to solve this problem?


When you make a mistake like this, you need to access Cloud Shell in safe mode (as you mention). When you do so, you will be logged in to Cloud Shell as root and you should be able to edit the .bash_profile file in your regular home directory to remove the offending line:

vi /home/<your user name>/.bash_profile

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.