user2565010
user2565010

Reputation: 2030

How to change git shell's start directory in windows 7

I downloaded and installed the programs offered by GitHub including Git Shell.

The problem is that I want to set up the home directory of the Git Shell program to a custom one, but I don't know how to do that.

I tried changing the "start in" field from the properties menu of the Git Shell shortcut but it didn't work.

Can anybody please give me some information on how to change the home directory of the Git Shell to a custom one?

Upvotes: 37

Views: 25209

Answers (6)

Jack
Jack

Reputation: 91

Other answers didn't work for me, and I am on Windows 10. So for those looking for another way I added a line to my ~/.bashrc: cd /c/myfoldername

Works like a charm

Upvotes: 1

Judy007
Judy007

Reputation: 5860

Piotr Perak directions are accurate. however, for newer versions, you have to update the "Clone Path".


  1. Launch GitHub for windows.

  1. Click "Tools and Options" gear at top right > Options

  1. Change "Clone Path" to the directory you would like git to open at. Please see image below. Thank you.

enter image description here

Upvotes: 2

Honest Abe
Honest Abe

Reputation: 8758

  1. Right click on Git Shell
  2. Choose Properties
  3. Move to the end of the Target field
  4. Change --open-shell to --open-shell=c:\your_dir

Upvotes: 50

lanierhall
lanierhall

Reputation: 550

When I use @ssmith's answer it opens up in the right directory but does not have any of the features of posh-git. When I open it up normally it say s posh-git in the title, when I add this configuration it just says powershell...

I figured it out, use/create the file

C:\Users\yourUserName\Documents\WindowsPowerShell\Microsoft.PowerShell_profile.ps1

(the default profile) and then add the line mentioned above

Set-Location C:\Your\Start\Directory

Upvotes: 7

Piotr Perak
Piotr Perak

Reputation: 11088

1.Open GitHub Windows client.

2.Click tools (at the top of the window) and select 'Options'.

enter image description here

3.There you will find 'default storage location'. This is where Git Shell starts when you run it.

enter image description here

Upvotes: 47

ssmith
ssmith

Reputation: 734

According the article below (in the "Posh-Git and PowerShell" section) you should be able to create a Documents\WindowsPowerShell\GitHub.PowerShell_profile.ps1 file that will start when your GitHub PowerShell starts. In that file you can add the Set-Location c:\path\to\repo command.

For what it's worth, in case anyone comes across this but has a Bash shell, adding the command cd /path/to/repo to ~/.basrc should do the trick.

http://haacked.com/archive/2012/05/21/introducing-github-for-windows.aspx

Upvotes: 3

Related Questions