Bug 580628 - GIT_SSH environment variable prevents connection to GitLab
Summary: GIT_SSH environment variable prevents connection to GitLab
Status: NEW
Alias: None
Product: EGit
Classification: Technology
Component: Core (show other bugs)
Version: 6.0   Edit
Hardware: All All
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Project Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2022-08-26 11:03 EDT by Roberto De Gasperi CLA
Modified: 2022-08-26 11:24 EDT (History)
0 users

See Also:


Attachments
Error for Tortoise Git SSH usage (4.58 KB, image/png)
2022-08-26 11:03 EDT, Roberto De Gasperi CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Roberto De Gasperi CLA 2022-08-26 11:03:38 EDT
Created attachment 288699 [details]
Error for Tortoise Git SSH usage

EGit fails on Windows to clone existing repository (fails to connect to repository) when SSH_GIT environment variable is defined and points to TortoiseGit or core Git installation implementation of SSH, despite (Git CMD and Git Bash and Git GuI and Windows CMD and Tortoise Git) working with the same SSH keys.

With GIT_SSH=C:\Program Files\TortoiseGit\bin\TortoisePlink.exe, the following error occurs (see attachment +++):

org.eclipse.jgit.api.errors.TransportException: git@gitlab.com:user/project.git: not found.
	at org.eclipse.jgit.api.LsRemoteCommand.execute(LsRemoteCommand.java:192)
	at org.eclipse.jgit.api.LsRemoteCommand.call(LsRemoteCommand.java:131)
	at org.eclipse.egit.core.op.ListRemoteOperation.run(ListRemoteOperation.java:116)
	at org.eclipse.egit.ui.internal.clone.SourceBranchPage$9.run(SourceBranchPage.java:377)
	at org.eclipse.jface.operation.ModalContext$ModalContextThread.run(ModalContext.java:122)
Caused by: org.eclipse.jgit.errors.NoRemoteRepositoryException: git@gitlab.com:user/project.git: not found.
	at org.eclipse.jgit.transport.BasePackConnection.noRepository(BasePackConnection.java:574)
	at org.eclipse.jgit.transport.BasePackConnection.readAdvertisedRefsImpl(BasePackConnection.java:213)
	at org.eclipse.jgit.transport.BasePackConnection.readAdvertisedRefs(BasePackConnection.java:179)
	at org.eclipse.jgit.transport.TransportGitSsh$SshFetchConnection.<init>(TransportGitSsh.java:318)
	at org.eclipse.jgit.transport.TransportGitSsh.openFetch(TransportGitSsh.java:153)
	at org.eclipse.jgit.api.LsRemoteCommand.execute(LsRemoteCommand.java:170)
	... 4 more
Caused by: java.io.EOFException: Short read of block.
	at org.eclipse.jgit.util.IO.readFully(IO.java:203)
	at org.eclipse.jgit.transport.PacketLineIn.readLength(PacketLineIn.java:316)
	at org.eclipse.jgit.transport.PacketLineIn.readString(PacketLineIn.java:180)
	at org.eclipse.jgit.transport.BasePackConnection.readLine(BasePackConnection.java:190)
	at org.eclipse.jgit.transport.BasePackConnection.readAdvertisedRefsImpl(BasePackConnection.java:211)
	... 8 more

With GIT_SSH=C:\Program Files\Git\usr\bin\ssh.exe, the following error occurs:
org.eclipse.jgit.api.errors.TransportException: git@gitlab.com:user/project.git: git@gitlab.com: Permission denied (publickey).

	at org.eclipse.jgit.api.LsRemoteCommand.execute(LsRemoteCommand.java:192)
	at org.eclipse.jgit.api.LsRemoteCommand.call(LsRemoteCommand.java:131)
	at org.eclipse.egit.core.op.ListRemoteOperation.run(ListRemoteOperation.java:116)
	at org.eclipse.egit.ui.internal.clone.SourceBranchPage$9.run(SourceBranchPage.java:377)
	at org.eclipse.jface.operation.ModalContext$ModalContextThread.run(ModalContext.java:122)
Caused by: org.eclipse.jgit.errors.NoRemoteRepositoryException: git@gitlab.com:user/project.git: git@gitlab.com: Permission denied (publickey).

	at org.eclipse.jgit.transport.TransportGitSsh.cleanNotFound(TransportGitSsh.java:201)
	at org.eclipse.jgit.transport.TransportGitSsh$SshFetchConnection.<init>(TransportGitSsh.java:325)
	at org.eclipse.jgit.transport.TransportGitSsh.openFetch(TransportGitSsh.java:153)
	at org.eclipse.jgit.api.LsRemoteCommand.execute(LsRemoteCommand.java:170)
	... 4 more

Removing the GIT_SSH environment variable altogether resolved the issue.
Comment 1 Roberto De Gasperi CLA 2022-08-26 11:24:56 EDT
Typo within description "SSH_GIT environment variable" = "GIT_SSH environment variable"