how can i connect GitHub through putty - github

I had follow the steps given in so many docs like this one,
after creating a key i pasted it in my GITHUB account>account settings>SSH key.
When I add it there it shows a message:" key is invalid".

I really don't link the tutorial part which mentions:
Save the private key somewhere with a passphrase and then copy the public key text to the clipboard.
"somewhere"? ssh keys must be saved in %HOME%\.ssh.
(Note: %HOME% doesn't exists in windows, and default to %USERPROFILE%)
Make sure to have your public and private keys saves in:
%USERPROFILE%\.ssh\id_rsa
%USERPROFILE%\.ssh\id_rsa.pub
set HOME=%USERPROFILE%
plink git#github.com

Related

GitHub SSH key on a USB drive

I'm curious if I can put a GitHub SSH key on a USB flash drive as a singular key and remove the other SSH keys from my GitHub. I've found one source, but it doesn't necessarily specify that it's for GH, here.
Any help is appreciated, thanks!
I have yet to experiment, just reading articles/watching YouTube videos to try and get a grasp on it.
As long as you are using a ~/.ssh/config file which points where your SSH key is, you can put said key pair wherever you want.
Host gh
Hostname github.com
User git
IdentityFile /mnt/usb-device/myKey
In your case, a nix copy --to file:///mnt/usb-device /path/to/key would be needed first.
However, the tutorial you are referring to is more about copying the key on an encrypted USB stick. Which might be a bit redundant, considering NixOS can be installed with Full Disk Encryption already.

Key saved but not correctly

I was able to save my key on GitHub. (It does not end in .pub).
When testing if this was done correctly and using the 'ssh -T git#github.com' code, there is something off.
The terminal asks me if I want to continue, and I wrote 'yes', then a pop-up box asking for a password came up... I input nothing and clicked "unlock", which resulted in the bottom code saying "Permission denied". (see screenshot).
I'm not sure what to do here--I have followed the instructions multiple times.
Please let me know how to fix this.
When you add your SSH key to GitHub, that would be the one ending with .pub.
Then, double-check the correct private key is used with:
ssh -Tv git#github.com
It would ask for a passphrase only if you have created the private key with a passphrase.
If you did, make sure to add your key to the agent first.
Check also your ~/.ssh permissions.

Export GitHub acceptable SSH key in OpenSSH format from PuTTYgen

I am adding an SSH key to my GitHub account.
To do that, I open PuTTYgen and press the button "Generate".
When the key pair has been generated, I use the menu and open "Conversions" and "Export OpenSSH Key".
Then I go into GitHub, settings SSH and GPG Keys, press "new SSH key" and paste the contents of the generated file into the textbox (adding the title "github").
But I get a message about an invalid key.
Key is invalid. You must supply a key in OpenSSH public key format.
Why?
I have also tried to
Select "force new file format" and
the normal "save public key" button
A solution would be to let GitHub create the key, but I have not seen how.
Use the public key in the format shown in the PuTTYgen's "Public key for pasting into OpenSSH authorized_keys file" box.

unable to get SSH keys working between sourcetree and github

I was able to create a key and connect to github following these instructions via the command prompt successfully:
https://help.github.com/articles/generating-ssh-keys
However, when I try to connect via Sourcetree and putty I cannot. I've tried:
generating a new key with the putty key generator (SSH-2 RSA)
entering a passphrase
saving the private key
saving the public key and adding a .pub extension
copying/pasting the key from the putty key generator window into github
attemping to refresh branches on a pull from my private github repository from my local repo using the SSH clone URL I got from github
I also tried opening the key generated from the github command line instructions and it wanted me to convert it to a putty-type key which I did and saved off, tried with that one. Also no luck.
What am I doing wrong?
In order to get it worked I ended up going to Tools -> Options -> SSH Client and changing it to OpenSSH. I generated and uploaded several different types of keys trying to get it work as well but I think this is what finally did it.
In my case, I needed to switch to a git or ssh based repo path rather than the https based repo path. This causes SourceTree to switch to SSH based authentication.
This setting can be found at Repository => Repository setting => Paths
Example:
Correct repo paths
git#github.com:<username>/<reponame>.git
or
ssh://git#github.com/<username>/<reponame>.git
(Note: if you are working with a repo that isn't yours, replace username with organization name)
Wrong repo path
https://github.com/<username>/<reponame>.git
HTTPS repo paths result in SourceTree trying to be extra smart and failing spectacularly. You get prompted for a username/password GUI dialog which will never work if you have 2 factor authentication enabled.
To login to Github account using SourceTree you may use access tokens. To create an access token follow these steps.
Go to Settings
Select Developer settings from left pane
Select Personal access token
Click on Generate new token button
Give it a name
Select scopes and generate token (save this token somewhere safe because you won't be able to access this token again)
Then in SourceTree app follow these steps (for Mac users, not sure about the other platforms)
Go to Preferences->Accounts
Click add button
Select GitHub from Host dropdown
Choose Basic from Auth Type dropdown and HTTPS from Protocol dropdown
Enter your GitHub username in Username field
Paste the access token generated in the previous process in the Password field
Click save and you're done
For Mac versions of SourceTree the Tools menu does not exist.
However, you can add the ssh key to your keychain in Mac OS. See: https://superuser.com/questions/879050/sourcetree-ssh-options-on-os-x
On Mac OSX, the native SSH client can use the built-in keychain directly. To add your private key to the keychain simply use the command:
ssh-add -K /path/of/private/key
As an example if your private key is stored at ~/.ssh and is named id_rsa, you would use the command:
ssh-add -K ~/.ssh/id_rsa
You will then be prompted for your passcode, which will be stored in your keychain. After this you should be ready for a password-less login.
You may want to consider switching from OpenSSH to Putty / Plink and use embedded Git instead of Git provided by host OS. Making ssh-agent work on Windows is a bit more complicated than clicking it out straight from the SourceTree and PuttyGen.
If you want to still use terminal to configure SSH and start ssh-agent please see bottom two steps.
For Sourcetree on MacOS I had to change from OAuth to Basic authentication, use "git" as the username (not my GitHub username), and generate the SSH key and input it into GitHub. Only then could I clone a GitHub repo via SSH in Sourcetree.

Unable to use key file Eclipse

I setup public key access to my server via ssh. I have a .ssh folder on my local windows computer. I configured ssh to add the private key using the ssh-add <directory> command. I am able to successfully connect to my server using windowspowershell. The chmod and Chown of the .ssh directory and authorized file are configured correctly on my server. sshd_config is configured correctly and points to the correct key.
The connection works perfectly with shell so there is no problem on my server. But with Eclipse, and its plugin in particular, Egit, I keep getting a Unable to use key file <directory of the key file I loaded into eclipse the same one used by ssh error every time I try to push my revision commits to my git repository on the server. I went to Pref > General > Network > SSH2 and added the right private key, the ssh2 home directory is set correctly too, in fact the public an private key were both generated using the key management tab and loaded into my server.
My windows permissions on that folder and those keys is set to allow all users to do everything just for good measure.
Now one clue is, the known hosts tab has a host fingerprint that does not match the fingerprint of my key. My key is something like f1:19: etc and the hosts fingerprint is different. I hope I can fix this soon. Any suggestions would be great.
ssh-add -l = two private keys that I am using. So its not this.
Another clue is, after going into my putty program and changes the private key that it ses suddenly is i try to connect to ssh with a key acces in eclipse the error it throws shows reflects the same key that I just changed in putty!! Somehow eclipse seems to be using putty for public key access. How do I stop this?!
Okay here's the solution. For whatever reason Egit uses putty to connect to ssh using the configuration putty is set to use to access a server with a public key. The way you fix this is to make sure putty is able to connect to the server using a public key. If it can't then try this:
Download puttygen
Generate a rsa key using either ssh shell or the key management tab on eclipse. Do not generate a key using puttygen. For whatever reason it never worked for me.
Load the private key you generated (not generated with puttygen) into puttygen and then save as a putty private key (.ppk)
Go to eclipses key management tab and set it to recognize the new .ppk private key file
Finally go to putty, and create your servers profile by assigning the address and then go to auth and load the .ppk file. DISABLE pageant.
Save and attempt to connect to server using the key and if successful then congratulations Egit and Eclipse will now be able to make connections using keys.