Skip to content

fix: support hashtag and special chars in branch names for git clone#4644

Open
Siumauricio wants to merge 1 commit into
canaryfrom
claude/thirsty-pascal-5d64f2
Open

fix: support hashtag and special chars in branch names for git clone#4644
Siumauricio wants to merge 1 commit into
canaryfrom
claude/thirsty-pascal-5d64f2

Conversation

@Siumauricio

Copy link
Copy Markdown
Contributor

What

Escape the branch name when building the git clone shell command across all git providers (gitlab, github, gitea, bitbucket, custom git).

Why

Fixes #4585. Branch names were interpolated unquoted into the shell command:

git clone --branch ${gitlabBranch} ...

In shell, # starts a comment — and # is a valid character in git branch names. So a branch like feature#123 became git clone --branch feature, dropping the rest of the command (repo URL, output path), and the clone failed.

How

Wrap the branch with quote() from shell-quote, which is already a dependency of packages/server and already used in the docker/compose/railpack builders. This properly handles # and any other shell metacharacters consistently with the rest of the codebase.

Applied to:

  • packages/server/src/utils/providers/gitlab.ts (the one in the issue)
  • packages/server/src/utils/providers/github.ts
  • packages/server/src/utils/providers/gitea.ts
  • packages/server/src/utils/providers/bitbucket.ts
  • packages/server/src/utils/providers/git.ts

Branch names were interpolated unquoted into the git clone shell command,
so a `#` (valid in git branch names) started a shell comment and dropped
the rest of the command, causing the clone to fail (#4585).

Escape the branch name with shell-quote (already a dependency) across all
providers: gitlab, github, gitea, bitbucket and custom git.
@dosubot dosubot Bot added size:S This PR changes 10-29 lines, ignoring generated files. bug Something isn't working labels Jun 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working size:S This PR changes 10-29 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Hashtag in branch name not supported

1 participant