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

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

Related

How to use SSH connect Gitea and SourceTree?

now I long to build a private git server myself by gitea and use SourceTree as a git GUI (on Windows)
Current situation & steps:
1.I've already set up a host with gitea, and create a repos here.
2.I used SourceTree (putty) to create a public SSH key and save the .ppk file.
3.Adding this SSH on gitea page (something might be wrong because there is a verification button)
4.Using Pageant.exe on client to add key
5.Using SourceTree and try to clone the new repos by SSH
6.However, SourceTree on Client can not recognize the url
note:
1.both two computers connect to Local Area Network
2.opening port:3000 on host is done, and using "telnet HOSTNAME 3000" on client is successful
3.error message when using git command is here
Is there any step I did wrong?

Error in the checkout of a Github using Subversion with SSH - Linux Command line

Github recently enforced a no password rule with their repository access. I can't do two factor authentication, so, I am stuck with SSH keys. I want to use subversion, but when I try to checkout my repo, using:
svn co "svn+ssh://git#github.com/Oiubrab/ozzymandais.git"
I get the error:
Invalid command: 'git#github.com svnserve -t'
You appear to be using ssh to clone a git:// URL.
Make sure your core.gitProxy config option and the
GIT_PROXY_COMMAND environment variable are NOT set.
svn: E170013: Unable to connect to a repository at URL 'svn+ssh://git#github.com/Oiubrab/ozzymandais.git'
svn: E210002: To better debug SSH connection problems, remove the -q option from 'ssh' in the [tunnels] section of your Subversion configuration file.
svn: E210002: Network connection closed unexpectedly
From the research I've done, I think I need to edit the /home/user/.subversion/config file, but i have no idea how and there is no documentation as to how to use svn with github with ssh. I have setup an ssh key and popped it on my github account. I just need to know how to setup the subversion tunnel to github.
I don't think that github supports the svnserve protocol.
AFAIK, you should generate a personal access token (PAT) in GitHub and use it as a password in the Subversion client. I.e., enter your PAT when the client prompts you for a password.

Gitkraken cannot use local SSH agent

I have recently changed my GitHub username and when I try to push with Authentication > Use local SSH agent selected, GitKraken push fails with following error:
Push Failed
Configured SSH key is invalid.
Please confirm that it is properly associated with your git provider.
Unselecting the option reveals proper private/public key pair located at
~/.ssh/id_rsa
~/.ssh/id_rsa.pub
and allows the push to be done.
I can also push from inside Eclipse, and via command line without error. The URL of the repository point to my new username.
So far I have checked several things:
ssh -T github.com
gives permission denied
Fingerprint of id_rsa.pub matches to a key existing in Github account.
The following command suggests that ssh tool tries rsa private key, but is rejected:
$ ssh -vT github.com
debug1: Offering RSA public key: /home/<user>/.ssh/id_rsa
debug1: Authentications that can continue: publickey
debug1: Trying private key: /home/<user>/.ssh/id_dsa
debug1: Trying private key: /home/<user>/.ssh/id_ecdsa
debug1: Trying private key: /home/<user>/.ssh/id_ed25519
debug1: No more authentication methods to try.
Permission denied (publickey).
What is causing ssh -vT to fail in this case, and why doesn't it prevent git push/pull but fails when GitKraken tries pushing?
For me this was caused by an upgrade to OSX Sierra. I had to execute
ssh-add -k ~/.ssh/id_rsa
(you might have to replace that with the path of the key you are using). The command adds the ssh key to the git agent. For more information see the GitHub Help Page about adding SSH Keys.
You might have to add the command to some sort of setup file which is run at boot, because it seems like the ssh agent doesn't remember the key (at least for me).
For people who will come here in the future, my case was that pull/push working on vsc but gitkraken was giving me the message : no auth sock variable.
I went into file > preferences > SSH > unmarked use local SSH agent then it automatically found my id_rsa, ida_rsa.pub (you can browse and locate them manually if needed)
and now everything working fine.
OS: Arch,
gitkraken version: 7.7.2
What helped me resolve the issue was to go to GitKraken preferences and connect both Bitbucket and Github and authorize them.
After that tick the box in "general" that says use local ssh agent. (might be
If you have already set-up your local SSH agent, and your Git in terminal works, but Gitkraken does not, this might help:
First, start gitkraken from your terminal, instead of a desktop shortcut:
Open your favorite terminal
Run gitkraken
See if "Pull" works, or any other authenticated operation
It it works, you need to edit your Gitkraken desktop shortcut:
In my scenario, this is where my desktop shortcut is located, so: sudo vim /usr/share/applications/GitKraken.desktop
Change Exec=gitkraken %f to Exec=env SSH_AUTH_SOCK="${XDG_RUNTIME_DIR}/ssh-agent.socket" gitkraken %f

Private Github Repositories with Envoy

Anybody has any problems deploying with Laravel's envoy when using private Github repos?
When manually cloning my repo from the production server, the ssh key seems to be accessible but when using Envoy, I always get a "Permission denied (publickey) error.
Thanks
It is probably because the ssh key on your remote server requires a password.
If you change the Envoy.blade.php to perform some other task you should be able to establish whether you are connecting to your remote correctly.
#servers(['web' => 'user#domain.com'])
#task('deploy')
cd /path/to/site
git status
#endtask
Should return something like:
[user#domain.com]: On branch master
Your branch is up-to-date with 'origin/master'.
nothing to commit, working directory clean
If you are connecting using a Mac or Linux you probably don't have to enter your password because your terminal is using ssh-agent which silently handles your authentication.
Wikipedia article on ssh-agent
When connecting over ssh, ssh-agent isn't running and the script is being prompted for a password which is where it is failing.
To get around this you could to generate a new key on the remote machine that doesn't use a password.
If you want to restrict the ssh key to a single repository on GitHub have a look at deploy keys
You need to pass the -A (as per the man page it - Enables forwarding of the authentication agent connection. This can also be specified on a per-host basis in a configuration file) in you ssh string.
You will also need add your ssh key for agent forwarding (on the machine which can access the git remote which I assume be your localhost)
ssh-add -K ~/.ssh/your_private_key
Something like this
#servers(['web' => '-A user#domain.com'])
#task('deploy')
cd /path/to/site
git status
#endtask
Git remote commands should now work.

Egit ssh problems

I have been trying to get gitHub and Egit to cooperate, with no success. I installed github's software bundle and made an SSH key that way, but Egit gives me no prompt for the passphrase, and it gives me this error:
Cannot get remote repository refs.
Reason: ssh://git#github.com:22: passphrase for C:\Documents and Settings\User\.ssh\id_rsa
I have these settings in the push menu:
URI: ssh://git#github.com/YoungMaker/<projectName>.git
host: github.com
Repository path: /YoungMaker/<projectName>.git
protocol: SSH
port <BLANK>
User: git
password <blank>
I also tried the GIT_SSH environment variable, and set it to C:\Documents and Settings\User.ssh, as well as plink.exe (I don't know what that is (clearly some .exe))
After trying to push from the gitHub GUI, I got this error. Its quite strange because I have the C:\Documents and Settings\User.ssh directory with a config file and an id_rsa key in it.
Pushing to git#github.com:YoungMaker/GitTester.git
error: cannot spawn C:\Documents and Settings\User\.ssh: No such file or directory
fatal: unable to fork
Old question, but for future reference:
Make sure you did setup a push remote. It worked for me when I got both the Cannot get remote repository refs-problems ("... Passphrase for..." and "Auth fail" in the "Push..." dialog).
Provided that you already:
Setup your SSH keys with Github (Window > Preferences > General > Network Connections > SSH2)
Setup your local repository (you can follow this guide for that)
Created a Github repository (same guide)
... here's how you do it:
Go to the Git Repositories view (Window > Show View > Other > Git Repositories)
Expand your Repository and right click Remotes --> "Create Remote"
"Remote Name": origin, "Configure push": checked --> click "OK"
Click the "Change..." button
Paste your git URI and select protocol ssh --> click "Finish"
Now, click "Save and Push" and NOW you should get a password prompt --> enter the public key passphrase here (provided that you DID (and you should) setup a passphrase to your public key) --> click "OK"
Now you should get a confirmation window saying "Pushed to YourRepository - origin" --> click "OK"
Push to upstream, but this time use "Configured remote repository" as your Destination Git repository
Go get yourself a well earned cup of coffee!
The passphrase is needed if you created a private key protected by one, as described in "GitHub: SSH key passphrase".
But that means you need an SSH agent to provide that passphrase for you.
If Egit doesn't prompt for one when pushing, that could mean:
your SSH key wasn't protected by a passphrase
your SSH key isn't somehow accessible (wrong path, or wrong protection on that path)
See also Vogella's tutorial: