Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Push/Pull Freeze on Windows #15

Closed
henrymei opened this issue Aug 15, 2013 · 8 comments
Labels

Comments

@henrymei
Copy link

@henrymei henrymei commented Aug 15, 2013

The problem I experienced trying to get SublimeGit/ST2 to run on Windows was that any remote git call caused ST2 to lock up and freeze. This seems to be a known issue, and the problem is caused by Git requiring the ssh passphrase for any push/pull operation. The documentation points here, which uses ssh-agent to store credentials. This allows Git Bash to only ask for the passphrase on first run and not any time after. However, I still experienced the same issue.

@henrymei

This comment has been minimized.

Copy link
Author

@henrymei henrymei commented Aug 15, 2013

I am outlining my workaround and hope this will be beneficial for anyone working with Windows.

It seems that SublimeGit requires credential storing for the command prompt (i.e. cmd.exe) and not Git Bash. I will assume that we're using msysgit. Make sure Git is added to your PATH.

  1. Grab a copy of PuTTY, Plink, Pageant, and PuTTYgen from here and save them somewhere (e.g. I just threw them all in C:\PuTTY\ ).
  2. Add a system variable called GIT_SSH that points to the location of Plink (e.g. C:\PuTTY\plink.exe). If you're using an older version of mysysgit, there was actually an option to use Plink instead of OpenSSH.
  3. Generate your public/private key pair using PuTTYgen. Be sure to secure your key by using a passphrase. You should be generating a SSH-2 RSA key of typically 1024 bits. Save the private key somewhere, and add the public key generated to the list of SSH public keys on your GitHub account (i.e. go to github.com and look in your account settings).
    Note: If you tried the OpenSSH workaround I linked when I opened the issue, you can just convert your OpenSSH private key to a PuTTY key also using PuTTYgen (the public key will be same regardless). Your OpenSSH keys will be in ~.ssh, which is %USERPROFILE%.ssh . OpenSSH public keys have the *.pub extension and private keys no extension. PuTTY private keys have the *.ppk extensions. Make sure to choose the OpenSSH private key when opening with PuTTYgen and save it as a *.ppk.
  4. Grab GitHub's public key. Use PuTTY to SSH into github.com. If you've never done this before, it should pop up an alert saying that the server's host key is not cached in the registry. Hit "Yes" to add the key to PuTTY's cache. After doing this, exit PuTTY. We won't be using it again.
  5. Run Pageant. This will create an icon in your system tray. Double click to open a window where you can add your private key. The agent will sit in the background, much like ssh-agent, and provide authentication when necessary.

As long as Pageant is running, any git calls through the command prompt should be automatically authenticated, allowing SublimeGit to not freeze.

Pageant will default to a clean session every time it runs, but it takes key paths as parameters (i.e. pageant.exe <key path 1> <key path 2> ... ). There are a few ways to make things easier. You can add the path to the keys after the target path in the Pageant shortcut (i.e. for me, this would be "C:\PuTTY\pageant.exe" %USERPROFILE%.ssh\id_rsa.ppk ) or just write a batch file to make it autostart in Windows. Pageant will always prompt for the passphrases of keys you auto-load on startup.

@miped

This comment has been minimized.

Copy link
Contributor

@miped miped commented Aug 15, 2013

Wow, this is a fantastic walkthrough. I will integrate this into the documentation.

@henrymei

This comment has been minimized.

Copy link
Author

@henrymei henrymei commented Aug 15, 2013

Thanks! I should probably amend my workaround to load the key automatically as well.

@henrymei henrymei closed this Aug 15, 2013
@albertosantini

This comment has been minimized.

Copy link

@albertosantini albertosantini commented Dec 7, 2013

Great tip.

I would add to start Sublime Text, changing Target field in Sublime Text properties, with the following string:
C:\My\Path\pageant.exe %USERPROFILE%.ssh\id_rsa.ppk -c C:\My\AnotherPath\SublimeText\sublime_text.exe

If you restart Sublime Text, only at the first time pageant asks the passphrase.

(The backslash is broken in troubleshooting wiki page)

@escherpf

This comment has been minimized.

Copy link

@escherpf escherpf commented Dec 8, 2013

Thank you for this tip. I have a question on step 4. After hitting "yes" on the popup alert, another screen prompts to "login as:"

Do you just close this window without entering anything. Or do you log in and, if so, using what? I tried using my github user name and it did not work.

Thank you.

@henrymei

This comment has been minimized.

Copy link
Author

@henrymei henrymei commented Dec 8, 2013

You should be using your GitHub username and password to SSH.

@escherpf

This comment has been minimized.

Copy link

@escherpf escherpf commented Dec 8, 2013

Thank you for the quick reply. It turns out that it worked by immediately closing the window without entering anything at the 'login as' prompt. Now everything works brilliantly. Thank you for this workaround!

@nathanhere

This comment has been minimized.

Copy link

@nathanhere nathanhere commented Nov 16, 2016

Thanks for the tip @albertosantini. What a great integration into the windows workflow! For some reason I just needed an extra backslash after '%USERPROFILE%:

C:\My\Path\pageant.exe %USERPROFILE%****.ssh\id_rsa.ppk -c C:\My\AnotherPath\SublimeText\sublime_text.exe

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
5 participants
You can’t perform that action at this time.