Skip to content

fix(git): keep the leading slash of an absolute scp-style repo path - #1217

Merged
jeff-r2026 merged 1 commit into
Tencent:mainfrom
jayhemnani9910:fix/git-scp-absolute-path
Oct 20, 2026
Merged

jeff-r2026 merged 1 commit into
Tencent:mainfrom
jayhemnani9910:fix/git-scp-absolute-path

Conversation

@jayhemnani9910

Copy link
Copy Markdown
Contributor

Summary

git@host:/srv/git/team.git names a repository at an absolute path on the SSH host, and git@host:srv/git/team.git one relative to the login's home directory. parseGenericGitRepoInput strips the leading slash before rebuilding the scp-style URL (parsePath in src/providers/git/repo-url.ts), so teamai init git@host:/srv/git/team.git --provider git clones srv/git/team.git instead. On a plain SSH Git server that keeps repositories under /srv/git the clone fails with "Could not read from remote repository".

The scp branch now keeps the slash when the input had one. HTTPS and ssh:// URLs already rebuild the path with a slash and are unchanged.

Type of Change

  • Bug fix (non-breaking change that fixes an issue)
  • New feature (non-breaking change that adds functionality)
  • Breaking change (fix or feature causing existing behavior to change)
  • Documentation only
  • Refactor / internal cleanup

Test Plan

  • npx tsc --noEmit passes
  • npm run lint passes
  • npx vitest run passes (10989 pass; the same 6 tests fail on main here: two submodule-checkout cases that need git >= 2.54 (local 2.53), one hooks-reconcile-scope real-shell case, and three Cursor tests that need a sqlite3 CLI this machine does not have)
  • Added/updated tests for the change

git@git.example.com:/srv/git/repo.git is added to the "preserves the clone path across repeated parsing" cases in generic-git-provider.test.ts; on main it comes back as git@git.example.com:srv/git/repo.git.

Real CLI, throwaway HOME, with GIT_SSH_COMMAND pointing at a script that logs the remote command and exits:

teamai init git@git.example.com:/srv/git/team.git --provider git --role dev --agent claude --force
  • 0.27.0: ssh git@git.example.com git-upload-pack 'srv/git/team.git'
  • this branch: ssh git@git.example.com git-upload-pack '/srv/git/team.git'
  • git clone git@git.example.com:/srv/git/team.git: git-upload-pack '/srv/git/team.git'
  • git@git.example.com:group/team.git asks for 'group/team.git' before and after.

Related Issues

None found.

Copilot AI balanced review requested due to automatic review settings October 19, 2026 10:58

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@github-actions

Copy link
Copy Markdown

No findings in the specified PR diff.

The fix preserves the leading slash for absolute scp-style paths while leaving relative paths unchanged. The added regression case checks exact URL preservation and repeated parsing.

The PR description includes sufficient testing: a representative real-CLI run records the corrected absolute path passed to git-upload-pack. No additional provider/agent matrix is required.

Review was read-only; I did not run, build, or install PR code.

@jeff-r2026
jeff-r2026 merged commit 4843f67 into Tencent:main Oct 20, 2026
14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants