Community
Participate
Working Groups
I enter the following URI for my git repository: ssh://git@bitbucket.org:my-account/my-repo.git When I save project and view URL of repository it appears to have triple slash for schema, i.e. ssh:///git@bitbucket.org:my-account/my-repo.git It later fails to clone the repo with the following stack trace: ERROR: Error cloning remote repo 'origin' hudson.plugins.git.GitException: Could not clone ssh:///git@bitbucket.org:my-account/my-repo.git at hudson.plugins.git.GitAPI.clone(GitAPI.java:244) at hudson.plugins.git.GitSCM$3.invoke(GitSCM.java:1016) at hudson.plugins.git.GitSCM$3.invoke(GitSCM.java:963) at hudson.FilePath.act(FilePath.java:793) at hudson.FilePath.act(FilePath.java:775) at hudson.plugins.git.GitSCM.gerRevisionToBuild(GitSCM.java:963) at hudson.plugins.git.GitSCM.checkout(GitSCM.java:742) at hudson.model.AbstractProject.checkout(AbstractProject.java:1523) at hudson.model.AbstractBuild$AbstractRunner.checkout(AbstractBuild.java:610) at hudson.model.AbstractBuild$AbstractRunner.run(AbstractBuild.java:517) at hudson.model.Run.run(Run.java:1434) at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:44) at hudson.model.ResourceController.execute(ResourceController.java:82) at hudson.model.Executor.run(Executor.java:137) Caused by: hudson.plugins.git.GitException: org.eclipse.jgit.api.errors.JGitInternalException: Exception caught during execution of fetch command at hudson.plugins.git.GitAPI$1.invoke(GitAPI.java:237) at hudson.plugins.git.GitAPI$1.invoke(GitAPI.java:224) at hudson.FilePath.act(FilePath.java:793) at hudson.FilePath.act(FilePath.java:775) at hudson.plugins.git.GitAPI.clone(GitAPI.java:224) ... 13 more Caused by: org.eclipse.jgit.api.errors.JGitInternalException: Exception caught during execution of fetch command at org.eclipse.jgit.api.FetchCommand.call(FetchCommand.java:143) at org.eclipse.jgit.api.CloneCommand.fetch(CloneCommand.java:179) at org.eclipse.jgit.api.CloneCommand.call(CloneCommand.java:125) at hudson.plugins.git.GitAPI$1.invoke(GitAPI.java:231) ... 17 more Caused by: org.eclipse.jgit.errors.NotSupportedException: URI not supported: ssh:///git@bitbucket.org:my-account/my-repo.git at org.eclipse.jgit.transport.Transport.open(Transport.java:556) at org.eclipse.jgit.transport.Transport.open(Transport.java:430) at org.eclipse.jgit.transport.Transport.open(Transport.java:314) at org.eclipse.jgit.transport.Transport.open(Transport.java:284) at org.eclipse.jgit.api.FetchCommand.call(FetchCommand.java:118) ... 20 more Trying next repository FATAL: Could not clone repository hudson.plugins.git.GitException: Could not clone repository at hudson.plugins.git.GitSCM$3.invoke(GitSCM.java:1027) at hudson.plugins.git.GitSCM$3.invoke(GitSCM.java:963) at hudson.FilePath.act(FilePath.java:793) at hudson.FilePath.act(FilePath.java:775) at hudson.plugins.git.GitSCM.gerRevisionToBuild(GitSCM.java:963) at hudson.plugins.git.GitSCM.checkout(GitSCM.java:742) at hudson.model.AbstractProject.checkout(AbstractProject.java:1523) at hudson.model.AbstractBuild$AbstractRunner.checkout(AbstractBuild.java:610) at hudson.model.AbstractBuild$AbstractRunner.run(AbstractBuild.java:517) at hudson.model.Run.run(Run.java:1434) at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:44) at hudson.model.ResourceController.execute(ResourceController.java:82) at hudson.model.Executor.run(Executor.java:137) It kind of works if I leave the ssh:// schema prefix out, but my repo has submodules and it fails later on, when parsing the .gitmodules file. I am going to write up the bug on this shortly
I've created Bug 423068 that describes why I cannot leave 'ssh://' prefix out.
I checked the job's config.xml, and nowhere in the config there is a full URL path. Here is the relevant section: <remoteRepositories> <RemoteConfig> <name>origin</name> <uris> <org.eclipse.jgit.transport.URIish> <scheme>ssh</scheme> <path>git@bitbucket.org:my-account/my-repo.git</path> <rawPath>git@bitbucket.org:my-account/my-repo.git</rawPath> <port>-1</port> </org.eclipse.jgit.transport.URIish> </uris> So, I guess, the problem is somewhere in the URL constructor, that parses this metadata and inserts extra slash(/)
Created attachment 237978 [details] Test for dubious use of URIish.toPrivateString In this test URIish is constructed from the same parts found in the job's config.xml. As you can see call to 'toPrivateString' results in a triple slash.
Figured out that URL was not correct. ssh bitbucket URL should be: ssh://bitbucket.org/my-account/my-project.git This way URI is serialized into this XML <uris> <org.eclipse.jgit.transport.URIish> <scheme>ssh</scheme> <path>/my-account/my-project.git</path> <rawPath>/my-account/my-project.git</rawPath> <user>git</user> <port>-1</port> <host>bitbucket.org</host> </org.eclipse.jgit.transport.URIish> </uris> I think there is still an issue in that the plugin should provide validation for SSH URL conformance.