Skip to content

Feature request: support SSH-style git URLs #34

@krokicki

Description

@krokicki

When the git repo is configured with SSH (i.e. the remote starts with "git@github.com:krokicki/myproject.git") then binary packing fails as follows (gitfs.New fails the same way):

$ gitfs ./...
panic: failed parsing URL: git@github.com:krokicki/myproject.git

goroutine 1 [running]:
github.com/posener/gitfs/internal/localfs.urlProjectName(0xc0001a2c60, 0x26, 0x1, 0x1)
        /Users/tester/go/pkg/mod/github.com/posener/gitfs@v1.2.1/internal/localfs/localfs.go:99 +0x1fb
github.com/posener/gitfs/internal/localfs.computeSubdir(0x189fe74, 0x28, 0xc0001b9540, 0x18, 0x0, 0x0, 0x20, 0x18)
        /Users/tester/go/pkg/mod/github.com/posener/gitfs@v1.2.1/internal/localfs/localfs.go:45 +0x14b
github.com/posener/gitfs/internal/localfs.New(0x189fe74, 0x28, 0xc00003600c, 0x1, 0xc00019a040, 0x1e7c801, 0x2, 0xc00024fb38)
        /Users/tester/go/pkg/mod/github.com/posener/gitfs@v1.2.1/internal/localfs/localfs.go:24 +0x84
github.com/posener/gitfs.New(0x19a95e0, 0xc0001a4000, 0x189fe74, 0x28, 0xc00024fbf0, 0x1, 0x1, 0x30, 0xc000275170, 0x0, ...)
        /Users/tester/go/pkg/mod/github.com/posener/gitfs@v1.2.1/gitfs.go:199 +0x136
project/cmd.generateDockerfile(0x1891c4c, 0x18, 0x17e6760, 0xc000275170)
        /Users/tester/dev/project/cmd/init.go:207 +0xf8
project/cmd.initProjectJavaMaven()
        /Users/tester/dev/project/cmd/init.go:161 +0x17f
project/cmd.glob..func1(0x1ecaf40, 0xc000241110, 0x1, 0x1)
        /Users/tester/dev/project/cmd/init.go:59 +0x1f8
github.com/spf13/cobra.(*Command).execute(0x1ecaf40, 0xc0002410d0, 0x1, 0x1, 0x1ecaf40, 0xc0002410d0)
        /Users/tester/go/pkg/mod/github.com/spf13/cobra@v1.0.0/command.go:846 +0x29d
github.com/spf13/cobra.(*Command).ExecuteC(0x1ecb1e0, 0x10437aa, 0x1e87fe0, 0xc000000180)
        /Users/tester/go/pkg/mod/github.com/spf13/cobra@v1.0.0/command.go:950 +0x349
github.com/spf13/cobra.(*Command).Execute(...)
        /Users/tester/go/pkg/mod/github.com/spf13/cobra@v1.0.0/command.go:887
project/cmd.Execute()
        /Users/tester/dev/project/cmd/root.go:24 +0x31
main.main()
        /Users/tester/dev/project/main.go:6 +0x20

It worked after switching to HTTPS style remote ("https://github.com/krokicki/myproject.git") It would be nice if the SSH style was also supported.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions