diff --git a/pkg/git/git.go b/pkg/git/git.go index b148f401f..8a6ae36aa 100644 --- a/pkg/git/git.go +++ b/pkg/git/git.go @@ -61,5 +61,7 @@ func RepoOwnerAndNameFromUrl(url string) (string, string, error) { repoOwner := repoArr[0] repoName := repoArr[1] + repoName = strings.TrimSuffix(repoName, ".git") + return repoOwner, repoName, nil } diff --git a/pkg/git/git_test.go b/pkg/git/git_test.go index 125c2d16f..b0d1d7d81 100644 --- a/pkg/git/git_test.go +++ b/pkg/git/git_test.go @@ -17,6 +17,13 @@ func TestGetRepoOwnerFromGHURL(t *testing.T) { wantName: "bar", wantErr: false, }, + { + name: "correct with dot git suffix", + url: "https://gh/foo/bar.git", + wantOwner: "foo", + wantName: "bar", + wantErr: false, + }, { name: "correct with capital letters", url: "https://gh/FOO/bar",