After installing TortoiseGit I used its puttygen.exe to generate a key. This gave me something like

---- BEGIN SSH2 PUBLIC KEY ----
Comment: "test@example.com-20110212"
AAAAB3NzaC1yc2EAAAABJQAAAQEAguK4gT6H6J0dKtf5S8NA8FkYHagIoKipN21Y
z0Ut6VAdwlUkE83aX96lZajrijes/fKPNbttAulwONLdtRXJMlJmUrOji13hNHTm
XLHlfRoFZpvq1wI8Wbt8RwdgTC/D7MVPUzjWkYOwVS9ywoUUee29nyHZDxv8rKL1
abZnCXHrEZdR0uutw+y02bm1KDL+suGGp5ecttAKPiWtWseH1R+aZZFgo9xFjl9K
UFzeIHUEYSnUX32+mSoIdHs4vZvzOCmZV0Q8/OUUWAsF1kaeH2Krp+dUazDNsVdb
/hlQMviPd38EKR/AzaMKLGEhWtWn3Sgt2FL/N1X8oJYUrLxmkw==
---- END SSH2 PUBLIC KEY ----

but git-dev.drupal.org doesn't like it and tells me

The key is invalid. It must begin with ssh-rsa or ssh-dss.

Need help with public keys? View the excellent GitHub.com SSH public key help at http://github.com/guides/providing-your-ssh-key.

So I click the link to a page that tells me

Attempting to redirect to the guide for your OS. If the redirect fails, pick your OS:

* Windows
* Mac
* Linux

Clicking the Windows link gets me to http://help.github.com/key-setup-redirect/msysgit-key-setup, which says

Page does not exist! Read the Full Documentation

Hmm...

Comments

eliza411’s picture

How frustrating ... I'll be glad to work on sorting this out.

First, during upcoming documentation sprints attention to Windows directions is scheduled.

Second, the most current (and not broken) link for SSH keys is on http://drupal.org/node/1027094 and references http://theillustratednetwork.mvps.org/Ssh/Private-publicKey.html

Sadly, what seems to be GitHub's current directions for TortoiseGit at https://github.com/multitheftauto/multitheftauto/wiki/how-to-use-tortois... leads me to an Internal Server Error.

Finally, it's on my to-do list to write Drupal.org-focused key-gen directions, but I'm not sure when I can get there (Help welcome!)

At the very least I'll look at getting that message that leads to the wrong place updated.

eliza411’s picture

I did find this: http://help.github.com/msysgit-key-setup/, tested the directions and it works. I'll be updating our docs accordingly.

bdragon’s picture

That's an SSH2 format key.

You need to load the key into puttygen and copy paste the text from the "Public key for pasting into OpenSSH authorized_keys2 file:" textarea.

Although I suppose it would be nice if the system used ssh-keygen -i to convert incoming SSH2 pubkeys into the corresponding openssh keys..

salvis’s picture

Thank you for your fast reply, eliza411!

I have JavaScript disabled, which is why I ended up on http://help.github.com/key-setup-redirect/, which has the bad link. Obviously, this is an issue on github, but it falls back on us. Enabling JS effectively got me to http://help.github.com/msysgit-key-setup/

I'm semi-educated on this ssh stuff, just enough to be completely confused. I've been using Putty for ages, which comes for Pageant for ssh key authentication. I'm not sure how msysgit intends to do it, but TortoiseGit comes with its own version of Pageant, even though it seems to be using msysgit underneath. This puzzles me to no end...

The trouble with msysgit is that I work under a non-administrator Windows account. msysgit's Setup requires administrator rights, so you have to run it under a different account. The trouble is that msysgit is then hard-wired to c/Users/admin_account/.ssh, which is inaccessible to the non-administrator work account. msysgit's Setup sets the system-wide "HOME" variable to the directory of the user that runs Setup, instead of "%USERPROFILE%", which would make this work. This can be fixed, of course, but it's not straight-forward, and it annoyed me enough that I decided to try TortoiseGit's puttygen first.

msysgit's ssh-keygen has now given me a key that seems to be acceptable. However, the test at the end of http://help.github.com/msysgit-key-setup/ is not working — ssh salvis@git-dev.drupal.org gets me a Password prompt. Is this because that last step of the github instructions doesn't apply to g.d.o, or because something's wrong with my set-up so far. Having such a checkpoint would definitely be useful.

So I try

git clone ssh://salvis@git.drupal.org/projects/acl.git

(according to http://drupal.org/node/1013552).

It tells me

Cloning into acl...
The server's host key is not cached in the registry. You
have no guarantee that the server is the computer you
think it is.
The server's rsa2 key fingerprint is:
ssh-rsa 2048 65:83:8e:7d:ef:3c:aa:2c:fd:0d:15:42:d6:45:47:e4
Connection abandoned.
fatal: The remote end hung up unexpectedly

Something is not working right, but I have no clue, where the problem could be.

Maybe 'git-dev' instead of 'git'? — Same result.

Check the project page: http://git-dev.drupal.org/node/87985/git-instructions

git clone --branch 6.x-1.x salvis@git-testing.drupal.org:project/acl.git acl

(add --branch, no protocol, 'git-testing', no //, colon instead of slash (!?), add directory)

That's a vastly different command, but the result is still the same error message.

Time to go to the "Troubleshoot 'git clone'" page at http://drupal.org/node/1065850. There's nothing about trouble-shooting on that page, but instead another set of different instructions:

git clone --branch master http://git-testing.drupal.org/project/acl.git acl

Wow, this seems to have worked ('http'!)

Ok, now

git clone --branch master http://git-dev.drupal.org/project/acl.git acl

This prompts me for a user name, I enter it, and then it prompts me for a password. So, key authentication is not working. And the git-dev password that I set isn't accepted either.

The variety of command lines offered is mind-boggling, and I still don't even have a clue whether my key is working or not.

bdragon’s picture

"git clone --branch 6.x-1.x salvis@git-testing.drupal.org:project/acl.git acl" should have worked. It's possible that the server was overloaded when you tried or something.

The reason "git clone --branch master http://git-dev.drupal.org/project/acl.git acl" asked for a user name is because git-dev has http authentication to keep the bots out (remember? drupal/drupal) -- It won't work for a git checkout anyway, because it's the drupal.org test instance, not the repo.

salvis’s picture

(our messages crossed)

$ git clone --branch 6.x-1.x salvis@git-testing.drupal.org:project/acl.git acl
Cloning into acl...
The server's host key is not cached in the registry. You
have no guarantee that the server is the computer you
think it is.
The server's rsa2 key fingerprint is:
ssh-rsa 2048 69:35:9f:1b:a8:26:ad:6d:cc:93:29:25:6e:d7:25:2b
Connection abandoned.
fatal: The remote end hung up unexpectedly

What do you mean with "It won't work for a git checkout anyway, because it's the drupal.org test instance, not the repo."? Is the message above the expected behavior?

I think that 95% of the people who try this are people who already maintain a project on d.o. The obvious first move is to try to make a local clone of an existing project.

Creating a new project (which is touted prominently everywhere) is the 5% use case. I couldn't care less at this point. I need to know how I can keep maintaining my existing projects after the big switch to git! Am I too early for trying this?

bdragon’s picture

Oh, it showed the key cached in registry comment again? That's probabaly what's gumming it up.. Try using putty or plink to connect to git-testing.drupal.org first and accept the fingerprint.

bdragon’s picture

If that was the case, this will need to be documented. I am seeing evidence through searching that this is a common problem when mixing putty with git...

salvis’s picture

Accepting the host key using PuTTY worked. Now I'm just getting

$ git clone --branch 6.x-1.x salvis@git-testing.drupal.org:project/acl.git acl
Cloning into acl...
fatal: The remote end hung up unexpectedly

Still not what I'd like to see.

eliza411’s picture

What version of Git are you using? (In Git Bash, type 'git --version')

salvis’s picture

git version 1.7.4.msysgit.0

The trouble is I have no clue whether it's a local or remote key issue, or I have a wrong command line, or what...

eliza411’s picture

If you were to join us on Freenode in #drupal-gitsupport, we might be able to sort it out a little faster :)

salvis’s picture

I'm not sure that's the idea. Of course I really appreciate your help and the offer to go one-to-one, and I ultimately want to get this going for myself, but I thought the goal here was to refine the instructions and processes so they can hold up against real life situations.

Here you have one such real life situation. And you have a guy who is completely new to git and who wrestles with all the problems that everyone else will encounter, too, and who is dedicated and capable of giving you all the feedback you may want.

Are you sure you want to go the one-to-one route?

P.S. The instructions on http://help.github.com/msysgit-key-setup/ are great because they include a success/failure test at the end. You can tell whether you've reached the milestone or not. This is sorely missing here.

eliza411’s picture

I could have created better docs if I'd been able to solve this today. As is, this issue will be here for others to help with.

I did create directions at http://drupal.org/node/1066762. Not sure if they'll stay around since the documentation policy says we're supposed to link off-site. Since Drupal.org supplies password auth I can understand that position. Keys are complex enough that I'd wanted to add directions a long time ago but had been dissuaded. Not sure how it will turn out.

Anyway, good luck with the keys.

salvis’s picture

I think I'm making some progress here.

When I try to install msysGit as non-admin, then I get a prompt that makes me choose from

( ) Use OpenSSH
( ) Use (Tortoise)Plink

No matter which one I choose, the installation fails in the end, because my Windows account doesn't admin rights.

If I install as admin, then I don't get that prompt at all. Still I have a global environment variable

GIT_SSH='c:\utils\plink.exe'

This is probably a left-over from a previous install, and it doesn't get removed when I uninstall msysGit.

After removing that global environment variable, things are looking better now: I get the expected

RSA key fingerprint is 69:35:9f:1b:a8:26:ad:6d:cc:93:29:25:6e:d7:25:2b.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added 'git-testing.drupal.org,140.211.15.103' (RSA) to the
list of known hosts.

But then I get

salvis@git-testing.drupal.org's password:

Is git-testing.drupal.org taking the credentials from dropal.org or from git-dev.drupal.org? (git-dev is closed.)

eliza411’s picture

From git-dev. It'll be open in an hour or so, and it is schedule to stay up for the next couple days.

salvis’s picture

Yay, it worked!

So here's what I learned: When setting up msysGit

  1. Run Setup as administrator.
  2. Select "Use OpenSSH" rather than "Use (Tortoise)Plink", when given the choice.
  3. If you can't create your key pair because ssh-keygen fails writing to the administrator directory then change the global "HOME" variable to %USERPROFILE%.
  4. If you don't get the yes/no prompt to accept the host key, or you can't get key authentication to work, then make sure that you don't have a "GIT_SSH" environment variable pointing to a plink.exe that's not part of your msysGit installation. If you have it, then just remove it.
  5. Finally, obviously, use the right git commands.

Thanks for all the help, eliza411 and bdragon!

eliza411’s picture

Status: Active » Fixed

Yay. I'm going to mark this fixed, then.

sun’s picture

The solution is to simple:

  1. Start PuTTY
  2. Connect to host git.drupal.org
  3. Confirm the host's signature/fingerprint
  4. Cancel the connection (STRG + C)
  5. Done. git should be able to perform all operations regardless of shell now (regular Windows command prompt, msysgit, or cygwin)
sun’s picture

Added that info to the howto section on http://drupal.org/node/1027094

salvis’s picture

@sun: I'm pretty sure that's what I did, and what got me the "fatal: The remote end hung up unexpectedly" error.

Sohodojo Jim’s picture

Sun, Salvis and Bdragon,

I, too, wish that Sun's 'five-step' fix-it was all that was needed but I am struggling with this as well. I'm on Windows 7 and have an otherwise Happy Camper relationship with TortoiseGit for both GitHub and my own remote repositories. Following the GitHub instructions was so quick and sure-fire that I was up and cooking pronto on that system.

Sadly, I am at a 'how many times will I hit my head on this wall' problem with getting my set-up to work with Drupal's git repo. I followed all the instructions for generating the key pair and got it in my SSH public key section of my DO user account, no sweat. But like salvis, no matter what I try via git-bash, command prompt, TortoiseGit... I get the same showstopper which is the Plink password prompt and the hang up.

I was hopeful that, as BDragon suggested that Puttygen would somehow work into a conversion/update situation. Say, for example, that something would get the DO repo into the known_hosts file in my .ssh subdirectory (which seems to be an important reference for TortoiseGit's putty configuration. Although I may try it, I hestiate to take salvis' approach of reinstalling TortoiseGit to stop using Plink for SSH as this is already working well in other situations. But if that turns out to be the only way, that'll have to do.

I'll keep an eye out for additional insights here and elsewhere and post any advances toward resolving this for myself.

--Sohodojo Jim--

Sohodojo Jim’s picture

Success!

I killed the TGitCache.exe process via Task Manager and reran the testing command:

git clone mygitdrupalname@git-testing.drupal.org:project/examples.git

which re-prompted for the public key acceptance. This gets the testing-DO repo into my known_hosts file which is good. The clone then inits the empty project directory... again good and expected. But then I am hit with the password prompt.

I then figured I would beat on puttygen a bit (as per Bdragon's suggestion). I then did 'File/Load private key' to import the private key I generated following the basic Drupal Git Windows key/auth instructions. (I had already uploaded my public key into my DO account as per instructions.) I then did a 'Save private key' (a button in the PuTTYgen dialog-window) which converts and saves your SSH-generated key into a 'ppk' file format that TortoiseGit is happy with (when installed with the recommended Plink config rather than SSH alternative).

I then did a typical 'Git clone...' within Windows Explorer in the directory where I wanted my cloned project repo to be.

In the TortoiseGit 'Git clone' dialog, I pasted the username@repo-url portion of the clone command mentioned above (and set the destination directory).

NOW HERE IS THE IMPORTANT PART: I then checked the 'Load Putty Key' checkbox and browsed to the directory and selected the '.ppk' (Plink-friendly) version of my private key, hit 'OK' and WHAM! TortoiseGit opened the 'cloning in process' window and sucked the project right down nothing flat! :-) Yeah, Happy Camper be I!

--Sohodojo Jim--

thePanz’s picture

@Sohodojo Jim: you can use PageAnt to handle and load a set of ppk keys entering only one time their passwords. You should now not check the "load putty key" in GIT dialog.

I'm writing a tutorial on how to set-up Drupal ssh keys with Putty instead of msysgit, you can find it here: http://thepanz.netsons.org/post/drupal-tortoisegit-and-putty-configuration

Sohodojo Jim’s picture

Hey Panz,

I saw the mention of your article on the mailing list and I greatly appreciate your having taken the time to figure out and document the 'correct' (or at least a substantially better way) to config TortoiseGit for Drupal repo access. In fact, I strongly believe that your article should as quickly as possible find its way into the docs here on the DO site as your method will surely help Windows-based devs to have a cleaner Git-start after the migration.

The experience report I provided is not a right/recommended way as much as it is a 'make-do' for getting back on track after having tried to follow the current instructions that don't work for TortoiseGit folks.

Regardless of whether it is your direct path or a winding road like I unfortunately took, once TortoiseGit is set up correctly, it is a great and efficient means to participate in the post-CVS Drupal Universe.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.