giter8 icon indicating copy to clipboard operation
giter8 copied to clipboard

sbt new ssh invalid private key

Open chepk opened this issue 3 years ago • 6 comments

steps

$ sbt -version
sbt version in this project: 1.5.1
sbt script version: 1.5.1

problem

Can't create project from private Gitlab repository using ssh.

  • ssh connection succeed
ssh -p 7999 -T [email protected]
Welcome to GitLab, @chepk!
  • git clone ssh://.. execution succeed
git clone ssh://[email protected]:7999/performance/gatling-template.g8.git
  • sbt new https://... execution succeed
sbt new https://my-gitlab.com:7999/performance/gatling-template.g8.git
  • sbt new ssh://... execution crashes with invalid privatekey message
sbt new ssh://[email protected]:7999/performance/gatling-template.g8.git
stack trace
$ sbt new ssh://[email protected]:7999/performance/gatling-template.g8.git
[info] welcome to sbt 1.5.1 (N/A Java 15.0.2)
[info] loading project definition from /Users/chepk/work/temp/project
[info] set current project to temp (in build file:/Users/chepk/work/temp/)
[info] set current project to temp (in build file:/Users/chepk/work/temp/)

ssh://[email protected]:7999/performance/gatling-template.g8.git : invalid privatekey: [B@718f3088

The private key was generated using ssh-keygen -t rsa

expectation

Project is created successfully using sbt new ssh://..

notes

chepk avatar May 04 '21 09:05 chepk

Have you tested it with bare g8? I'm asking just to understand if it is sbt or g8 related

TonioGela avatar May 29 '21 11:05 TonioGela

Have you tested it with bare g8? I'm asking just to understand if it is sbt or g8 related

No, only with sbt

chepk avatar Jun 18 '21 05:06 chepk

Okay, can you test it with the g8 version of this branch? The first comment should contain the instructions to build it locally, but I can help you out if you need it. It should fix authentication errors by simply reading the .ssh/conf file and using it to pick the correct ssh key.

TonioGela avatar Jun 18 '21 07:06 TonioGela

Just in case, the instructions are these:

checkout repo and publish local dependency

git clone https://github.com/TonioGela/giter8.git
cd giter8
git checkout SSH_FIX
sbt publishLocal

install Coursier

curl -fLo cs https://git.io/coursier-cli-"$(uname | tr LD ld)"
chmod +x cs
./cs install cs
rm cs

or install Coursier on Windows (using cmd.exe, not PowerShell)

bitsadmin /transfer cs-cli https://git.io/coursier-cli-windows-exe "%cd%\cs.exe"
.\cs --help

and then install locally the fixed version of giter8

cs bootstrap org.foundweekends.giter8:giter8-launcher_2.12:0.13.1-SNAPSHOT --main giter8.LauncherMain -f -o <custom-g8-path>

then you can run the custom version of g8 using the executable that you find at <custom-g8-path> like ./<custom-g8-path> or .\<custom-g8-path>.exe if you are on windows.

I hope that ./<custom-g8-path> ssh://[email protected]:7999/performance/gatling-template.g8.git won't cause the private key error

TonioGela avatar Jun 18 '21 07:06 TonioGela

@chepk version 0.14.0 should have solved the issue. Can you check?

TonioGela avatar Feb 17 '22 11:02 TonioGela

Sorry, I missed your comments. Asked colleagues to check

chepk avatar Feb 17 '22 12:02 chepk