Skip to content

Instantly share code, notes, and snippets.

@hernandazevedo
Forked from ricalo/.bashrc
Created December 26, 2017 12:01
Show Gist options
  • Save hernandazevedo/4648494140b7f80b6ddf0e566b83e9d9 to your computer and use it in GitHub Desktop.
Save hernandazevedo/4648494140b7f80b6ddf0e566b83e9d9 to your computer and use it in GitHub Desktop.
Use git-bash from Android Studio terminal
if [ ! -z "${IDE}" -a "${IDE}" == "AndroidStudio" ]; then
cd $OLDPWD;
fi

I love Git for Windows. It's just easy to move between Linux, Mac and Windows if I use the same tools.

Today I was wondering, how can I use bash from the terminal in Android Studio?

I ran into a blog post that explains how to do the same thing with Cygwin.

Since the Cygwin and git for Windows are similar I decided to give it a shot. Here are the steps:

  1. Create Bash-AndroidStudio.bat included in this gist.

  2. @echo off
    set IDE=AndroidStudio
    "C:\Program Files\Git\bin\bash.exe"
    
  3. Add the following to your .bashrc file

  4. if [ ! -z "${IDE}" -a "${IDE}" == "AndroidStudio" ]; then
        cd $OLDPWD;
    fi
    
  5. In Android Studio, go to settings and add the path to your batch file in Tools > Terminal > Shell path.

Open a new terminal... voila!

@echo off
set IDE=AndroidStudio
"C:\Program Files\Git\bin\bash.exe"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment