Current Behavior
When running the nx release task in a project where Git is configured to connect to GitHub via SSH over HTTPS (using port 443), the release step fails to create a GitHub release.
This failure only occurs if the Git remote URL is not in one of the push formats officially documented by GitHub:
- HTTPS:
https://github.com/user/repo.git
- SSH (shorthand):
git@github.com:user/repo.git
However, when the Git remote points to a fully qualified SSH URL over port 443, nx release fails to correctly extract the user/repo slug:
# git remote -v
origin ssh://git@ssh.github.com:443/ekkolon/nxdemo.git (push)
In this case, nx release incorrectly extracts the slug as 443/ekkolon instead of ekkolon/nxdemo.
Expected Behavior
nx release should correctly extract the user/repo slug from all valid GitHub remote URL formats, including canonical SSH URLs with a port.
Users shouldn't have to manually reconfigure their Git remotes to get nx release to create a GitHub release.
GitHub Repo
No response
Steps to Reproduce
- Configure GitHub and Git to use SSH over HTTPs
- Clone or create and push a GitHub repo configured to use
nx release
- Run
git remote -v
- If your Git origin points to a fully qualified SSH URL run
nx release
nx release creates the git tag and pushes it
nx release tries to create a GitHub release with the generated changelog but fails
I created a minimal reproducable example in the TypeScript Playground, where I modified the GithubRemoteReleaseClient.resolveRepoData() method suspected of causing the issue.
I replaced the inner CMD call to git remote -v with a hard-coded, fully qualified SSH URL: ssh://git@ssh.github.com:443/ekkolon/nxdemo.git
When you run this example, you should see the following in the logs:
{
"hostname": "github.com",
"apiBaseUrl": "https://api.github.com",
"slug": "443/ekkolon"
}
Nx Report
Failure Logs
Package Manager Version
pnpm 10.12.1
Operating System
Additional Information
Suspected Root Cause
This behavior appears to stem from the GithubRemoteReleaseClient#resolveRepoData() method, which uses a regex to extract the slug from the Git remote URL.
However, the regex currently only handles:
- SSH-style shorthand:
git@github.com:ekkolon/nxdemo.git
- HTTPS:
https://github.com/ekkolon/nxdemo.git
It does not match fully qualified SSH URLs with a port, such as:
ssh://git@ssh.github.com:443/ekkolon/nxdemo.git
Workaround
Manually updating the Git remote to the SSH format supported by GitHub prior to using nx release command resolves the issue:
git remote set-url origin git@github.com:ekkolon/nxdemo.git
But this may not be ideal in environments where port 22 is blocked or SSH over HTTPS is the preferred default.
Ideally GithubRemoteReleaseClient#resolveRepoData() method should support extracting the user/repo slug from fully qualified SSH URLs too.
I'm happy to follow up with a PR if you agree this is something worth addressing.
Current Behavior
When running the
nx releasetask in a project where Git is configured to connect to GitHub via SSH over HTTPS (using port 443), the release step fails to create a GitHub release.This failure only occurs if the Git remote URL is not in one of the push formats officially documented by GitHub:
https://github.com/user/repo.gitgit@github.com:user/repo.gitHowever, when the Git remote points to a fully qualified SSH URL over port 443,
nx releasefails to correctly extract theuser/reposlug:# git remote -v origin ssh://git@ssh.github.com:443/ekkolon/nxdemo.git (push)In this case,
nx releaseincorrectly extracts the slug as443/ekkoloninstead ofekkolon/nxdemo.Expected Behavior
nx releaseshould correctly extract theuser/reposlug from all valid GitHub remote URL formats, including canonical SSH URLs with a port.Users shouldn't have to manually reconfigure their Git remotes to get
nx releaseto create a GitHub release.GitHub Repo
No response
Steps to Reproduce
nx releasegit remote -vnx releasenx releasecreates the git tag and pushes itnx releasetries to create a GitHub release with the generated changelog but failsI created a minimal reproducable example in the TypeScript Playground, where I modified the
GithubRemoteReleaseClient.resolveRepoData()method suspected of causing the issue.I replaced the inner CMD call to
git remote -vwith a hard-coded, fully qualified SSH URL:ssh://git@ssh.github.com:443/ekkolon/nxdemo.gitWhen you run this example, you should see the following in the logs:
{ "hostname": "github.com", "apiBaseUrl": "https://api.github.com", "slug": "443/ekkolon" }Nx Report
Failure Logs
Package Manager Version
pnpm 10.12.1
Operating System
Additional Information
Suspected Root Cause
This behavior appears to stem from the
GithubRemoteReleaseClient#resolveRepoData()method, which uses a regex to extract the slug from the Git remote URL.However, the regex currently only handles:
git@github.com:ekkolon/nxdemo.githttps://github.com/ekkolon/nxdemo.gitIt does not match fully qualified SSH URLs with a port, such as:
Workaround
Manually updating the Git remote to the SSH format supported by GitHub prior to using
nx releasecommand resolves the issue:But this may not be ideal in environments where port 22 is blocked or SSH over HTTPS is the preferred default.
Ideally
GithubRemoteReleaseClient#resolveRepoData()method should support extracting theuser/reposlug from fully qualified SSH URLs too.I'm happy to follow up with a PR if you agree this is something worth addressing.