4

I'd like to create a bunch of shortcuts to open Git repository

GitKraken starts like this:

C:\Users\<username>\AppData\Local\gitkraken\Update.exe --processStart "gitkraken.exe"

I tried to just add the path like this, but nothing happened:

C:\Users\<username>\AppData\Local\gitkraken\Update.exe --processStart "gitkraken.exe  \"C:\<path to repo with spaces>\MyRepo1\""
C:\Users\<username>\AppData\Local\gitkraken\Update.exe --processStart "gitkraken.exe  \"C:\<path to repo with spaces>\MyRepo2\""
C:\Users\<username>\AppData\Local\gitkraken\Update.exe --processStart "gitkraken.exe  \"C:\<path to repo with spaces>\MyRepo3\""

There could be multiple problems:

  1. GitKraken might not support a path as parameter. Didn't find any documentation when I googled for "gitkraken from command line with repository path as parameter"
  2. Quotes within quotes might be wrong, but I think it's correct: Command line passing quotes within quotes
  3. The command line syntax might be different, but as mentioned above, I didn't find any documentation. I tried "-p" because I saw something similar while googling but it didn't work either C:\Users\<username>\AppData\Local\gitkraken\Update.exe --processStart "gitkraken.exe -p \"C:\<path to repo with spaces>\MyRepo1\""
Lernkurve
  • 20,203
  • 28
  • 86
  • 118

2 Answers2

6

GitKraken uses the Squirrel.Windows project for installation and update management for it's Windows installs. So the update.exe that is running when you click on the shortcut labeled "GitKraken" is running the Squirrel.Windows process that checks for and downloads updates and then runs the newest version of GitKraken. Once that check is complete, it launches the GitKraken.exe and starts the program.

To solve your issue you will need to pass a CLI option through the Squirrel call into the the gitkraken.exe. You are correct that gitkraken.exe accepts the -p | --path option for the repo to open at launch (e.g. gitkraken.exe -p "\path\to\repo"). If you run it from the app folder directly, you can see the options available at gitkraken.exe --help. Luckily, there are a couple of as-yet undocumented options you can pass that do the pass-through for you (referenced here) so your custom shortcut could now be:

..\Update.exe --processStart "gitkraken.exe" --process-start-args="--path \"d:\path with spaces\to\repo\""

Re: persistence through GitKraken executable updates- OP has confirmed in comments after GitKraken updated to v4.2 that the shortcuts they set up continued to work!

Edward
  • 3,292
  • 1
  • 27
  • 38
  • The following works if you have spaces in the path: `--process-start-args="--path \"d:\ – Lernkurve Dec 30 '18 at 21:33
  • Glad it worked for you @Lernkurve and thanks for the follow-up ( I did update the post to reflect what you found out able spaces.) Let me know if you discover how this works with updates to gitKraken! – Edward Jan 02 '19 at 16:51
  • Thanks a lot, Edward! – Lernkurve Jan 02 '19 at 21:26
  • 1
    Edward, so GitKraken just got auto-updated to version 4.2 and the desktop shortcuts still work fine. – Lernkurve Jan 08 '19 at 09:14
  • This only worked for me when I removed the = sign after --process-start-args and replaced it with a space. – Tim Friesen Sep 27 '19 at 16:25
0

This is what working for me in Ubuntu Desktop

Define it

gkk() { # gkk aka gitkraken
    repo_d=$1
    if [ -z $repo_d   ]; then repo_d=`pwd`; fi
    if [ ! -d $repo_d ]; then echo "Invalid :repo_d at $repo_d"; exit 1; fi
        /usr/bin/gitkraken -p $repo_d &
}

Use it

cd /path/to/your/repo
gkk

Note, calling the command again on 2nd repo will NOT work!

The workaround I can think of is to close and reopen GitKraken app

Nam G VU
  • 33,193
  • 69
  • 233
  • 372