Setting Default Home Directory with Git Bash

Recently I was getting a new development environment set up and I needed Git Bash. I noticed that Git Bash would start at an l drive when I launched it, instead of my user’s home directory. To change the directory to your user’s actual home directory, simply execute the following command:

[code language=”bash”]
echo "cd /c/Users/[username]" >> /l/.bashrc
[/code]

Make sure to replace [username] with your actual username or ID. Also, be mindful that you will be appending to this file, if it already exists, or creating the .bashrc hidden file automatically with the contents of the echo.

Also, if you use shortcuts with alias‘es via the .bash_profile, you will need to modify or create the .bash_profile in the home directory Git Bash launches in (ie, the l drive). For example,

[code language=”bash”]
$ cat /l/.bash_profile
alias mci=’mvn clean install -DskipTests -U’
[/code]

2 Comments:

  1. Very clear website , regards for this post.

  2. Pretty element of content. I just stumbled upon your site and in accession capital to claim that I get actually loved account your weblog posts. Anyway I will be subscribing in your augment and even I success you access constantly fast.

Leave a Reply

Your email address will not be published. Required fields are marked *