SSH and Egit with Eclipse Neon - eclipse

I have done the following:
Created the RSA 2048 with PuTTY, then saved the public and private keys at the location suggested by eclipse
Created the test repository at github and uploaded the public key to server
Created a HelloWorld project and added some text files
Problem:
Even choosing the Github SSH URL, I still get an authentication error message.
What else am I missing?

Make sure you reference the right folder in your Eclipse ssh configuration
And make sure the key generated through putty is not a ppk one, but an openssh one (id_rsa, id_rsa.pub). The id_rsa.pub content needs to be registered in your GitHub account.
And your ssh url needs to start with git#github.com (not yourlogin#github.com)

Related

How to push code to a GitHub Repo using Code Sandbox for iOS (2022)

I had trouble (even called support) and they could not answer correctly as to how to push code from CodeSandBox (iOS version) to a GitHub Remote Repo. I keep getting failed to connect (even using SSH and/either regular authentication). (They did lead me down part of the path)
The way that I finally got it to work:
Essentially you have to use SSH (not HTTPS - this will not work!!!! on iOS)
On GitHub
First create your repo on Github (private or public), I selected to create a private one
copy the SSH name address
git#github.com:yourusername/yourprojectname.git
In CodeSandbox,
Add your repo name in the git settings from above
In the SSH Settings, hit the magic wand at the top and let it generate the public and private for you (this was the key....), do not generate a key on your own at your command line (IT WILL NOT WORK)
In the private key passphrase (leave this blank)
Change your branch in the settings to "main" as you GitHub Repo points to
Back in GitHub
Go to your Repo, go to the settings for your repo (not on your account)
Go to Deploy Keys
Add a Deploy Key, paste in the public ssh-rsa key from your code sandbox (that you let it generate), Make sure you check the box "Allow Write Access)
Then you can now commit and push to your remote repository (Took me three days of troubleshooting to figure this out) -:)

How to use а private repository with VSCode?

A novice here, please type a small instruction describes how to use a private GitHub repo in VSCode
To configure a private repo, you first need to generate a public/private RSA key pair on your dev machine to be able to establish an ssh connection to your repo instead of an HTTP connection.
Just install Git for Windows in your development environment. During installation, please make sure that you have checked the option to include git bash, as you'll need it to create this key. Once installed, right click on your Windows user folder, select on Open git bash and then just run ssh-keygen (or if you are using Linux, you can just ssh-keygen) and go through the wizard.
This step will create a hidden .ssh folder that contains your public/private RSA key pair. Navigate to that folder.
The goal here with these keys is to configure your public key on GitHub. Open your id_rsa.pub file with notepad and copy its entire content. Then go to GitHub and under your user Settings > SSH keys just add a key and paste your entire public key plus an arbitrary name.
Now restart VS Code and press CTRL+ ' (Backtick) to open PowerShell and then run:
In case you haven't cloned your repo:
git clone git#github.com:{UserName}/{RepoName}.git
To Upload changes to your repo:
git add .
git commit -m "{Name for this commit}"
git push {Repo Origin name (default = Origin)} {Branch Name (Default = Master)}
Note. {} are for reference, do not include them in your commands.
VS Code has built-in support for Source Control, so if it is configured, VS Code will automatically detect changes and get them ready to commit with just a commit message and click. Also, there's a really good VS Core extension called GitLens. This can help you to 1-click push
That should do it. 😃
As of now (july 2019, not sure when this got added exactly) you can do this from within VSCode, just hit F1 in windows or ctrl+⇧+P (or ⌘+⇧+P on mac) to access the command palette of VSCode, then type or select Git: Clone and finally enter the URL of your repository, so something like https://github.com/MY_USERNAME/MY_PROJECT.git, finally choose the folder you want to use for your cloned repository (open the main folder that contains all your projects, no need to manually create a sub folder for the project itself, git will do this for you using the projects name)
To find your exact repository URL, open the projects github page and click on the green button on the top right that says "Clone or download", if you wonder if you should use HTTPS or SSH check out the github documentation
I had trouble with cloning a private repository from Github with VSCode. In my case the problem was that I followed Github docs instructions to generate SSH keys with Ed25519 algorithm and using these keys (id_ed25519.pub) with VScode and Github did not work for me.
I generated new keys with the RSA algorithm:
ssh-keygen -t rsa -b 4096 -C "your_email#example.com"
and after adding id_rsa.pub to my Github account settings VSCode started working with private repositories.
If Git is already installed
Copy the URL of your private repository
Go to the version control in VS Code
Click on clone repository (authentication required if not done already) and
Paste the copied URL in the edit text box as shown in the documentation.
i have same problem- but solution was simple:
Mistake was: in windows when you create a keys name should be "id_rsa" (windows cmd suggest rename yor keys).
if your key name is different simple rename private and public keys to "id_rsa" and "id_rsa.pub"
Then add keys via: ssh-add ~/.ssh/id_rsa (edit path if files in different).
Then add id_rsa.pub key to github profile settings(copy paste of content).
Now you can work with private repositories.
#Daniel summed it up but quick read for anyone who's having issues with generating ssh/adding it to github.
As #Kennet stated use ssh-keygen -t rsa -b 4096 -C "your_email#example.com" hit enter through, it will default to C:Users most likely.
Copy the ida_rsa.pub generated in github go to Setting -> Deploy keys (documentation I saw was outdated) and paste it in and name it ida_rsa.pub.
Note: Make sure to select "Allow write access" otherwise your pushes will be denied
If you want multiple ssh keys, this document explains how

Authentication failed. Please make sure that you added your private key to the ssh preferences

I am trying to deploy Jersey project with openshift eclipse plugin but I am getting this error Authentication failed. Please make sure that you added your private key to the ssh preferences I have gernerated to ssh key and saved it in the .ssh directory. I added this key on the openshif- seetings- add new key- I named it id_rsa like my stored one in the .git directory.
openshift ssh key:
The Eclipse tooling needs the private key that matches your public key in OpenShit. Otherwise git in Eclipse cannot clone the git repo in OpenShift. Make sure that you have the private key set in the Eclipse SSH2 preferences.
Another possible reason is (i dont habe enough details to know) if you're telling the OpenShift host to install a cartridge that is available in source from a git repo that OpenShift should clone. The above error shows you using an ssh-git-url. In this case you would have to make sure that the OpenShift host has the private key to clone from the git repo with the source code. This known issue is easily to work around using cartreflect as descrbed here:
https://issues.jboss.org/plugins/servlet/mobile#issue/JBIDE-18866
https://issues.jboss.org/plugins/servlet/mobile#issue/JBIDE-18911
For details on how to install the PRIVATE ssh key in OpenShift so that it can clone using an ssh-git-url look here:
https://bugzilla.redhat.com/show_bug.cgi?id=1163964#c0
Cheers
André

Netbeans fails to access GitHub using SSH key

My (newest) Netbeans (NetBeans IDE 7.3 (Build 201302132200)) seems to be failing completely, when I'm trying to access my own GitHub repo using SSH. It works without problems with HTTP URLs.
Since I've imported an existing local copy of GitHub repository (New > PHP Project with existing sources), created once with TortoiseGit, there were remote settings saved in local copy meta-data (probably in .git folder). So Netbeans offers option Select Configured Git Repository Location in Push to Remote Repository window. But is unsuccessful at that.
Tried following:
When I'm using SSH URL (git#github.com:user/reponame.git) and Password option, with account pass, Netbeans tries to connect GitHub (remote) and after circa 5 seconds throws error Cannot connect to the remote repository at git#github.com:user/reponame.git.
When using SSH URL with Private/Public Key option, Netbeans throws exactly the same error immediately, so I assume, that for some reason it doesn't even tries to connect GitHub.
What is even more strange (?), Netbeans is not asking for private key's passpharse. I've set it, but did not entered it to Netbeans deliberately, to test connection process. I was more than sure, that Netbeans will ask me to provide this passpharse, as it shouldn't be able to use private key without it. To my surprise, it hasn't asked for it and instead it thrown an error saying, that it can't connect GitHub. Of course, that was only a test. After entering correct passpharse, I'm getting exactly the same effects.
I've copied my repo's URL directly from GitHub website, without any modifications. It seems, that I can only use HTTP URL (https://github.com/user/reponame.git). This works and assures me that all items (URL, user, reponame, password, finally Internet connection) are OK. But, it seems, that Netbeans fails completely on SSH URL.
Above happens always, no matter if I select Select Configured Git Repository Location or Specify Git Repository Location in Push to Remote Repository window. No matter, what I'll do I can't access my repository via SSH in Netbeans and using HTTP is the only option.
I have created my private-public key pair using puttygen.exe from PuTTY's website. I saved private key in Netbeans installation directory and added public key to GitHub's SSH Settings page. I used step-by-step guide I normally use with TortoiseGit.
I don't know what else I could miss out or I'm doing wrong? Any idea?
For the record:
When generating keys with PuTTYgen, it's recommended for compatibility to export it as an OpenSSH key. This can be achieved by accesing Conversions > Export OpenSSH key menu.
After series of many tests, I found out that Netbeans:
Does not work to well with existing local copies of GitHub (or any other git) remote repositories.
Does not work at all with SSH keys generated by puttygen.
As for first, I had to remove entire folder cloned with TortoiseGit and clone the same repository using Netbeans-bundled tools (Team > Git > Clone). The same goes for Subversion (look here) -- so the general rule of thumb says, that when you're switching from another Git or SVN client to Netbeans, you should do a full, clean clone (or checkout) of remote repository as attempts to re-use existing copy will most likely fail.
As for second, follow instructions given in this GitHub article and use ssh-keygen (either from your local installation of Git for Windows, in case of Windows or from any other source) instead of puttygen -- SSH keys generated by it can't be used in Netbeans for setting up password-less login to GitHub.
As I wrote, I've been using TortoiseGit previously, which accepts and works well with puttygen keys, so it wasn't to obvious for me, that source of the problem is here.
After fixing this two problems (getting clean clone and generating correct keys), ale problems expressed in my question were gone and Netbeans works with GitHub repositories like a charm.
My solution was to use a the ssh-keygen with the PEM option:
ssh-keygen -t rsa -b 4096 -m PEM -C my#mail.xy
Netbeans 12 use JGit for the Git-tool and this supports only special kinds of ssh keys?

How to link Smartgit to GitHub

I have a public GitHub account for the last year or so. Yesterday I installed SmartGit on my Windows 7 PC. SmartGit works fine locally but I'd like to push to a remote repo on GitHub.
When I look at SmartGit -> Preferences -> Authentication I have selected to use SmartGit as SSH Client. The 'Known Credentials' area is empty.
Under Hosting Providers I have added my github account [username+password] and Clicking on 'Login at GitHub...' it opens the browser and I am logged in successfully.
I would have assumed there would be something populating the Known Credentials area? I tried in vain in see if I had some key-pair stored somewhere that SmartGit could use. Eventually I downloaded PuttyGen and created a pair of keys. I gave them silly names to begin with but after some reading renamed them to *id_rsa* and "id_rsa.pub" and dropped them into my c:\users\MYNAME.ssh directory.
Still no sign of any credentials in SmartGit.
When I run the 'Remote -> Manage Remotes -> Add I enter the git name (based on the link I get from the github repo. I get the "Provide Credentials for authenticating to the SSH Server 'github.com' as user 'git'. The dialog box has pre-populated the Private Key File with the id_rsa I dropped into the .ss directory.
I even went onto github and added this key to the list of SSH keys. Still no joy.
Anyone any suggestions ?
Assuming it works similar on github and bitbucket.
Today I got Smartgit 3.0.10 running with bitbucket by the following steps:
To upload local code
1) Created the repository in bitbucket manually through the website
2) Add your ssh key to the website ( PuttyGen > Conversions > Export OpenSSH )
3) In your local repos check the contents of reposDir.hg\hgrc , should look like
[paths]
default = ssh://hg#bitbucket.org/user123/reposXYZ
if not change it manually. You can also clone your empty repos and the check in the
local copy for this line.
Restart SmartGit and you should be able to push and pull.
If you use the "HTTPS clone URL" on github, it makes a link that requires no SSH keys.
These 2 articles explain it:
https://help.github.com/articles/which-remote-url-should-i-use
https://help.github.com/articles/generating-ssh-keys