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

会有一股神秘感。 提交于 2019-12-03 00:59:47

1.Open GitHub Windows client.

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

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

  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
lanierhall

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

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

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.

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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!