GIT $home directory using Powershell

git
So I’ve been trying to get GIT to start in “D:\Google Drive\Grad school\Adv web 2” and for the life of me I couldn’t get it to work. I also wanted to change my $home variable so I can quickly move around.

There are some great sites with some answers if you’re using pure Git Bash:

But if you’re using window’s GIT powershell, you have a whole different solution, which I found at http://superuser.com/questions/82053/setting-home-in-powershell

Basically you have to go to your user account’s document’s folder, create a folder called (exactly) “WindowsPowerShell” and then create a file called “profile.ps1” (make sure it’s not a .ps1.txt, just a .ps1) and in that file write the following code:

_________________________________

Write-Host “Hi Edward, welcome back your GITness!”
Remove-Variable -Force HOME
Set-Variable HOME “D:\Google Drive\Grad school\Adv web 2”
cd “D:\Google Drive\Grad school\Adv web 2”

_________________________________

Of course you don’t need to keep the Write-Host line but it’s nice to have a greeting sometimes.  Also note that I added the last line to the solution at the superuser site above, this way it ensures that it goes right into the new $HOME directory.

 

Comments

Leave a Reply

Your email address will not be published.