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

前端 未结 6 1857
鱼传尺愫
鱼传尺愫 2021-02-05 01:10

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 cust

相关标签:
6条回答
  • 2021-02-05 01:30
    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
    0 讨论(0)
  • 2021-02-05 01:33

    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

    0 讨论(0)
  • 2021-02-05 01:33

    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

    0 讨论(0)
  • 2021-02-05 01:44

    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

    0 讨论(0)
  • 2021-02-05 01:45

    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.

    0 讨论(0)
  • 2021-02-05 01:53

    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

    0 讨论(0)
提交回复
热议问题