Enabling "Load PuttyKey" on TortoiseGit - putty

The field for uploading a Putty Private Key is currently disabled on my Tortoisegit.
(source: iforce.co.nz)
Although I currently have valid paths to PuttyGen, GitBash, PuTTY and TortoiseGitPLink.exe. With the environment variable GIT_SSH leading to C:\Program Files\TortoiseGit\bin\TortoisePLink.exe
How to use PuTTY for git cli and git bash?
Create an environment variable called "GIT_SSH" with the path to the PuTTY plink.exe or preferably to TortoiseGitPLink.exe. This can be done on the command line by executing "set GIT_SSH=PATH_TO_PLINK.EXE" ("C:\Program Files\TortoiseGit\bin\TortoiseGitPLink.exe" on default installations) or permanently.
(source: iforce.co.nz)

This just bit me too. The problem is that you have checked out over https instead of using the git protocol (git#github.com:somerepo.git). Try that and see if it helps.

Related

svn hangs on checkout in Windows

Attempting to check out a repository using svn checkout svn+ssh://USER#REPO .
I have set my %SVN_SSH% variable to include the -v flag when calling plink.exe, and the last log I get is Using username "USER". After that the command line hangs indefinitely.
I get similar problems attempting to checkout the repository using TortoiseSVN and the Subversion integration in Intellij.
I have no problems connecting to the server using PuTTY or calling plink directly in the command line. Using the -v flag with plink, I get prompted for my password immediately after the line where it hangs using svn checkout.
I have Windows 7 Ultimate SP 1, svn version 1.8.13, plink release 0.60.
The problem seems to be that you have to use public key authentication for SVN to be able to use SSH in Windows properly.
There are a few tutorials online for how to do this, but the one that worked for me was this one.
The important difference, which I didn't find in other tutorials, was the usage of the chmod command to change access permissions to the public key file on the server.
It might be too late to say, but i've had the similar problem.
In mine case the issue was in the command line of the plink.exe.
To properly fix all issues and do not type infinite logins and passwords:
Use pageant.exe to add the ppk key and avoid manual input of the password.
Use SVN_SSH environment variable with the -l "<username>" parameters to avoid manual input of the user name and avoid usage the username in the svn repository url.
Use SVN_SSH environment variable with the -batch parameter to avoid hangs in a script mode.
The resulting SVN_SSH environment variable should look like this:
SVN_SSH="<path-to-plink>/plink.exe" -batch -l "<USER>"
warning: backslash character in a path in the SVN_SSH variable is an escape character, you have to use a double to self escape it or replace it a forward slash - /.
But be careful with the git svn command, because the SVN_SSH variable can break the git with the message:
Can't create session: Unable to connect to a repository at URL 'svn+ssh://...': Error in child process: exec of '' failed: No such file or directory at .../Git/mingw64/share/perl5/Git/SVN.pm line 310.
In that case you have to use the ssh-pageant from the msys or cygwin tools instead.
I've create another post with detailed description on how to do that step by step both for the svn.exe and git.exe: How to use git-svn with svn+ssh url

Git push over SSH by CMD file on Win 8

I need to create a .cmd file that pushes my repository to remote. However, .cmd files are open in standard command line and if I run "git push" in it, I guess standard HTTP authentication is used - I'm not asked for passphrase for my ssh key file and the authentication of course fails.
Pushing works fine in Git shell (Powershell configured for git from "Github for Windows"), however, how can I create clickable shortcut in Windows which runs a command in this shell?
I tried
C:\Users\Richard\AppData\Local\GitHub\GitHub.appref-ms --open-shell "push.cmd"
which did not work.
Also, I tried to run the .cmd file in normal shell adding
#setlocal
#set PLINK_PROTOCOL=ssh
git push
as advised here:
Running a batch file in git shell
but it made no difference - no query for my ssh key, authentication fails.
Can you help me make one of the two solutions working? Thanks.

emacs 24 on windows 7, tramp cannot find plink program

I am trying to use Emacs 24.2 with Tramp on windows 7 to remotely edit files on a linux server. I installed the Putty suit program and OpenSSH. I also placed the plink.exe in the putty suit into the bin folder under the emacs 24 folder, and added the folder emacs24/bin into the PATH environment variable.
However, when I try to access the remote file from emacs with the command in the minibuffer: /username#host:filename, I get the following error message from emacs: plink is not recognized as an internal or external command. It seems that emacs cannot find the plink program. But, when I try to run plink in windows cmd, it can find the plink program. Also, I can ssh to the remote server in windows cmd.
Can anyone tell me what's my problem? Do I need to install cygwin to make it work? Thanks a lot.
To get tramp with plink to work, I had to add my PuTTY path to my system search path.
On Windows 10:
control panel >> System & Security >> System >> advanced system settings >> enviroment variables
To PATH I appended the PuTTY path: C:\Program Files (x86)\PuTTY
I'm guessing the key is that from PowerShell or the command prompt, you need to be able to run plink without specifying the path.
I was able to resolve this and I did not have to install cygwin.
Try adding the path where putty was installed to your exec-path variable in emacs. Execute the following elisp code in emacs or put it in your .emacs file. Make sure the slashes are forward, not backslashes, as Emacs and Windows use different conventions.
(add-to-list 'exec-path "C:/Program Files (x86)/PuTTy")
check what exec-path is set to by typing C-h v exec-path

new computer, git pull origin is asking for a password

on my new computer, I setup git and my putty.exe and ssh key etc. just fine.
So I do a:
git pull origin
and then at the command prompt, I am asking for a password.
I have no idea what password it wants, and then it also asks for my server's password after a few failed attempts at the first password.
it asks for:
blahblah#serveradmin.com password:
What is going on?
(my git rep is hosted on a shared unix isp)
I already setup pageant to use my private key, and it gave me a popup to enter my passphrase. This is how it works on my old computer, and then when I open git-bash and do a 'git pull origin' it works fine without asking me anything.
Update II
So let me summarize what is happending here:
I have the exact same setup at my office computer (windows7) (desktop), and it works fine w/o asking me any questions. All I do b4 using git is run a .bat file that loads up pageant.exe:
C:\putty\pageant.exe "E:\code\pg_pk.ppk"
Then doing a git pull origin works fine, doesn't ask me for any password.
I had this on my laptop also, and it worked just like my office computer UNTIL I installed windows 7 on it. Now it asks me for a password even though pageant.exe is running (I can see it in my taskbar, and the key is loaded).
So today I grabbed the .bat file and the entire /putty folder and put it on my laptop, still doesn't work, it is asking me for a password when I type: git pull origin
(I am running the same version of git on both computers)
Really confused, what could it be?
It isn't clear from your question whether or not you set up Git to actually use PuTTY. What is the content of your GIT_SSH environment variable?
It should be set to the full path to plink.exe. Even better yet: if you also use TortoiseSVN or TortoiseHg, set GIT_SSH to their TortoisePlink.exe. TortoisePlink has been modified to not read from the standard input, but instead pop up a dialog window, if something goes wrong. Git redirects standard input, so that you cannot actually type anything into plink, if, for example, your server's IP address changes and plink asks you to type yes to confirm it, that won't work. (You'll have to invoke plink or putty manually, then say yes and they will save it in the registry.) TortoisePlink will instead pop up a Yes/No dialog box.
You ssh key passphrase.
To remedy, you can recreate a key on your new machine using ssh-keygen and then save in the git origin
I'd double-check your SSH keys--looks like it's not properly sending your identity.
I have found that pageant sometimes just does not work. IMHO it is far easier to set it up using a blank password key with command line ssh client. From memory:
Generate public/private key using git bash:
ssh-keygen -t RSA -C email#address
DO NOT specify password.
Upload the the contents of %USERPROFILE%.ssh\id_rsa.pub
Git should just work, including windows command line, git bash, tortoise, git extensions etc.
I encountered this problem as well. What worked for me, oddly enough, was not creating the repository via TortoiseGit, but rather via git init.

svn/ssh question in windows

I am trying to do a command line svn update on my windows machine (to use in a batch file), and I want it to emulate what my settings are in the Tortoise SVN GUI.
In the tortoise settings, we have to specify the following in the SSH client...
C:\Program Files\TortoiseSVN\bin\TortoisePlink.exe -l usernamehere -pw mypassword -i C:\Users\Mike\Documents\myprivatekey.ppk
and I simply right click update...
does anyone know how I would use the svn.exe to emulate the above? (using plink with a private key?)
If I am not clear on something please comment and I will work it out.
Best,
Mike
svn+ssh command line
Basically,
Edit the file c:\Documents and Settings\user\Application Data\Subversion\config
Locate the section named [tunnels]
Add the following line : ssh=c:/path/to/plink.exe -i c:/path/to/your/key.ppk
I couldn't get subversion to work with plink, so I used Git's SSH. Details on my wiki at http://wiki.dandascalescu.com/howtos/subversion/subversion_access_through_ssh_on_windows.

Resources