We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 040d564 commit 43b7b3fCopy full SHA for 43b7b3f
1 file changed
src/scm/index.js
@@ -65,10 +65,13 @@ export function detectRemote() {
65
export function detectRepoName() {
66
const origin = getOrigin();
67
if (!origin) return null;
68
- // Handle SSH: git@github.com:owner/repo.git
69
- // Handle HTTPS: https://github.com/owner/repo.git
70
- const match = origin.match(/[/:]([\w.-]+(?:\/[\w.-]+)+?)(?:\.git)?$/);
71
- return match ? match[1] : null;
+ // SSH: git@host:path/to/repo[.git]
+ const sshMatch = origin.match(/^[^@]+@[^:]+:(.+?)(?:\.git)?$/);
+ if (sshMatch) return sshMatch[1];
+ // HTTPS: https://[user:pass@]host/path/to/repo[.git]
72
+ const httpsMatch = origin.match(/^https?:\/\/[^/]+\/(.+?)(?:\.git)?$/);
73
+ if (httpsMatch) return httpsMatch[1];
74
+ return null;
75
}
76
77
// Auto-detect default branch
0 commit comments