Skip to content

Fix git push and remote operations failing on non-HTTPS remote URLs #1314

Open
eranturgeman wants to merge 1 commit into
jfrog:v3_erfrom
eranturgeman:use-git-remore-url-not-remote-name-in-git-ops
Open

Fix git push and remote operations failing on non-HTTPS remote URLs #1314
eranturgeman wants to merge 1 commit into
jfrog:v3_erfrom
eranturgeman:use-git-remore-url-not-remote-name-in-git-ops

Conversation

@eranturgeman
Copy link
Copy Markdown
Collaborator

  • All tests passed. If this feature is not already covered by the tests, I added new tests.
  • This pull request is on the dev branch.
  • I used gofmt for formatting the code before submitting the pull request.
  • Update documentation about new features / new supported technologies

Fix git operations failing when .git/config remote URL is not HTTPS

Push, BranchExistsInRemote, and RemoveRemoteBranch all resolved the remote URL by reading from .git/config via the remote name. This works when the repo was cloned over HTTPS, but fails in two scenarios:

  1. Bitbucket Pipelines CI — the pipeline agent overwrites the remote URL to an internal proxy URL (http://bitbucket.org/...) before the user script runs. go-git bypasses the pipeline's git proxy, so pushing to that URL directly fails with "authentication required".
  2. SSH-cloned repos — when a repo is cloned via SSH, .git/config stores a git@... URL. go-git detects SSH transport, sees HTTP auth credentials, and returns ErrInvalidAuthMethod. (SSH is not supported in Frogbot but this is a start for it)

GitManager already has remoteGitUrl which is guaranteed to be HTTPS — SetRemoteGitUrl explicitly normalizes any non-HTTPS URL to the HTTPS URL returned by the VCS provider API. Fetch was already using RemoteURL: gm.remoteGitUrl correctly; Push, BranchExistsInRemote, and RemoveRemoteBranch inconsistently were not.

The fix makes all three use gm.remoteGitUrl for the actual network connection, consistent with how Fetch already works.

@eranturgeman eranturgeman requested a review from orto17 May 14, 2026 11:51
@eranturgeman eranturgeman changed the title fix git remote issue Fix git push and remote operations failing on non-HTTPS remote URLs May 14, 2026
@eranturgeman eranturgeman added bug Something isn't working safe to test Approve running integration tests on a pull request labels May 14, 2026
@github-actions github-actions Bot removed the safe to test Approve running integration tests on a pull request label May 14, 2026
@eranturgeman eranturgeman added the safe to test Approve running integration tests on a pull request label May 14, 2026
@github-actions github-actions Bot removed the safe to test Approve running integration tests on a pull request label May 14, 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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant