Unable to connect / clone GitLab repo in eclipse, even though able to connect to it from command line - eclipse

I was trying to clone repository in eclipse from gitlab.
It was showing that I cannot checkout/commit repository unless generate ssh key pairs. It further gave me this link. I followed steps there. It created following files:
C:\Users\User Name\.ssh\id_rsa
C:\Users\User Name\.ssh\id_rsa.pub
Then I copy pasted public key back to GitLab.
Then ran this:
C:\Users\User Name>ssh -T git#xx.xx.xx.xx
The authenticity of host 'xx.xx.xx.xx (xx.xx.xx.xx)' can't be established.
ECDSA key fingerprint is SHA256:mZNjLhcagbXDWoshrvVT7wsMNbQ97UTGlJSfUsH6231.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added 'xx.xx.xx.xx' (ECDSA) to the list of known hosts.
Ubuntu 16.04.6 LTS
Enter passphrase for key 'C:\Users\User Name/.ssh/id_rsa':
Enter passphrase for key 'C:\Users\User Name/.ssh/id_rsa':
Welcome to GitLab, User Name!
So I feel I able to connect from command link.
However I am not able to connect in Eclipse.
I specified id_rsa file in eclipse as stated here.
Then I tried to clone repo in eclipse as follows:
But it keeps asking me password, without ever connecting:
My information in gitlab profile:
Email: user.name#domain.com
Name: User Name
User name: UserN
Whats wrong going on here? What I am missing / doing wrong?
PS: I have masked some text of repo URI and my username in 2nd image.

In first screen shot, when I put git instead of UserN for User, it worked. Afterwards it asked me password for id_rsa, which when provided, started cloning repository. Dont know why this worked. Can someone shed some light?

Related

Getting error while clone the gitrepo using ssh-key

I have created a public key after I have pasted it on GitHub then I have tried to do git clone.
But while doing the clone, it is asking for the password:
Did i do anything wrong?
First, make sure you have pasted your SSH public key in your User SSH setting page of your local GitHub instance, not github.com.
Second, test if you are correctly authenticated with:
ssh -Tv git#stg-...github-....local
^^^^^^^^^^^^^^^^^^^^^^^
your local GitHub server name
You should see which key is used, and if yours is selected.

How to link ssh key to ssh agent and push files to github account

I need help on how to link my ssh key to ssh agent.
On generating the key which was saved at (mykeys) which i can view, the codes belows where generated in the bash terminal window.
$ ssh-keygen
Generating public/private rsa key pair.
Enter file in which to save the key (/c/Users/user/.ssh/id_rsa): mykeys
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in mykeys
Your public key has been saved in mykeys.pub
The key fingerprint is:
SHA256:/DEK8rKIlb+j1aEVWL3jYG5I0dcuYk4DoKuxrHiGOws user#OshimiriAtata1
The error I keep getting for all my trials is:
No such file or directory
I have followed the instructions I get on various YouTube videos I am watching currently, but cannot figure out what the issue is.
I have tried the following:
ssh-add \~/.ssh/id_1895
ssh-add ..ssh/id_1895`your text`
ssh-add .ssh\\id_1895
ssh-add \~/.ssh/id_rsa`your text`
ssh-add \~/.Henry/.Data-set/.ssh_mykeys
All to no avail.
Please can you help me?
Following "Generating a new SSH key and adding it to the ssh-agent", the command would be:
sh-add C:\path\to\mykeys
And you would need a ~/.ssh/config file with
Host gh
Hostname github.com
User git
IdentityFile C:\path\to\mykeys
Test if this works with: ssh -Tv gh, you should see a welcome message similar to:
Hi *****!
You've successfully authenticated, but GitHub does not provide shell access.
You can use the URL with commands like:
git clone gh:myGitHubUser/myRepository
I ran into this same problem, it kept putting the file on my desktop. I discovered this when I went to search on the bottom left of my Windows machine and typed in the name of my file, in your case "mykeys".
Literally followed the same exact steps you did and it still put it on my desktop.

Cannot use git to clone in remote web server

I have created a Github repo to where I push my local changes using Git Bash, without any problems. I can also use Git Bash to connect to my remote web server (shared hosting) and navigate to the folder where I want to clone my Laravel site.
This is where the problems begin. When I do
$ git clone git#github.com:myusername/mylaravelsite.git
I get the error message:
Permission denied (publickey)
After some searching for a solution I found that I should make sure that I have a key by doing this:
$ eval "$(ssh-agent -s)"
Which gave this answer:
Agent pid 122372
Then according to the instructions I should do this
$ ssh-add -l
Which gave me this message:
The agent has no identities
Reading up a bit more I try to add the key again by doing
$ssh-keygen -t rsa
...which generated a key pair that I added with ssh-add, I was prompted for a passphrase which I entered twice.
Now, I still get Permission denied (publickey) when I try to access my github repo with ssh. I should also mention that I have created a new SSH key at the github account where I pasted the key I created (I opened .ssh/id_rsa-pub with notepad and copied the content).
What more can I try?
Finally found the answer in case anyone else has the same problem. It turns out that the public key also must exist in the remote web server (in the .ssh folder I uploaded the same rsa_id and rsa_id.pub files, that I created locally), not only locally and in the Github account.
Once I had figured that out and uploaded those files to the webserver, it worked to clone my github repo :-).

GitLab + Eclipse + SSH - "Auth failed" or "cannot open git-upload-pack"

This week I set up an new GitLab server. It is running.
Yesterday I forced him to be reachable via HTTPS for secure communication.
In Eclipse I generated an RSA-Key via the preferences.
But if I try to import an Git-Project (git#DOMAIN:GROUP/PROJECT.git) then:
without password filled in, I got the response: Auth fail: Invalid password or missing SSH key.
with my password filled in (but git username), I got the response:
Auth fail: Invalid password or missing SSH key.
with my user & password, I got the response:
Auth fail: Invalid password or missing SSH key.
Via HTTPS I get the response:
cannot open git-upload-pack
Please, what do I don't see?
From my answer from here:
I faced the same issue while migrating my project from github to bitbucket and this is how I resolved it:
Introduction: I will describe the ssh key usage here. A user generates a unique key to connect to remote machines using ssh. So you can create it locally. After, user uploads the keys to the remote machines where want to connect without password and more securely. On Git, the same thing happens, user creates a ssh key and uploads the generated key value to the git system providers like Github or Birbucket. After uploading your unique key, you must configure your development environment to let your git system provider communicate providing security over ssh key.
1) I was using ssh key to push my commits to remote with github in eclipse, the ssh key is set at window -> preferences -> General -> Network Connections -> SSH2 for eclipse (on git pushes, this ssh key is used if set). If you do not have any ssh keys on your machine then follow this article to generate one for you and set it into eclipse at the path above.
2) In your github or bitbucke account, find the screen where you can save your ssh key. For bitbucket, it is at https://bitbucket.org/account/user/[user-name]/ssh-keys/. '[user-name]' here is your user name at bitbucket. Open your 'id_dsa.pub' file (where you generated your ssh key) with a text editor, select all, copy and paste into your github/bitbucket accounts' ssh key addition section and then click add.
3) At eclipse, be sure to use the 'ssh' GIT URI for your project. Go to Window -> Preferences -> Team -> Git -> Configuration, click 'Repository Settings' tab and paste your GIT ssh URI to remote.origin.url.
4) Finally try to push your commits to remote. You mustn't face any errors, if you have please comment under my answer.
Regards...
Recently, I did have similar issues with GitLab but fixed it with:
First, I generated the ssh-rsa by using the MAC-OSX CLI and exported to GitLab. Git CLIs were working but no luck from Eclipse.
Then, I went to Eclipse > Preferences... > General > Network Connections > SSH2, Key Management tab, I regenerated the key from Eclipse but using the "Generate RSA key..." button. It had "RSA-1024" at the end, and exported to GitLab.
https and ssh are two different communication protocols.
If you want to access your GitLab repos with https url, you should use https url:
https://yourLogin#DOMAIN/group/project.git
If you are using git#DOMAIN:GROUP/PROJECT.git, it is an ssh url.
Now: ssh cloning should work provided you have correctly setup your SSH id_rsa and id_rsa.pub in your Eclipse: see EGit SSH configuration.
Make sure:
your private key isn't password protected at first.
your public key (id_rsa.pub) is published on your GitLab profile

Github Permission Denied

Banging my head on this github multiple user thing and hoping I can get some help!
I just added a new email to my existing github account, changed my git configs locally to the right name and email, and added the ssh key to github but when I try to push my new project I created it says permission denied. I have the right repo set up for my origin too.
What's confusing me is when I do ssh -T git#github.com it says you've successfully authenticated with my other user...
I know I'm missing something so if you see it please let me know!
Thanks
A full ssh url will work:
ssh://git#github.com/User/repo.git
But here, you might be using an scp-like syntax, like the question you mention:
github.com:User/repo.git
You risk using an entry "github.com" entry in a $HOME/.ssh/config file, which can then specify explicitly a different private key, as shown here.
Host github.com
Hostname github.com
User git
IdentityFile ~/.ssh/myprivatekey