Skip to content

Github: Handle ssh remote urls better #5126

@markphelps

Description

@markphelps

For synching with GitHub over ssh (although this may be the same with other providers but we've only seen it happen with GitHub), our git remote sync over ssh code does not correctly handle the cases where:

  1. A user puts an https url in the remote url field like:
storage:
  development:
    remote: "https://github.com/org-name/some-test-repo.git"
  1. A user does not put the username in the remote url even if the username is in the credentials config:
storage:
  development:
    remote: "github.com/org-name/some-test-repo.git"
    credentials: "github"

credentials:
  github:
    type: ssh
    ssh:
      user: git

It seems we should be:

  1. Trimming any protocol (ie https:// from the remote url if credential type set == ssh
  2. Prepending the username to the remote url before trying to pull/push if set in the credentials (ie: [email protected]/owner/repo.git
  3. If both ssh.user is set AND the username is set in the remote url like [email protected] AND they differ, then we should error at validation time

Then we also should update the docs at https://docs.flipt.io/v2/configuration/storage#git-remotes and https://docs.flipt.io/v2/configuration/storage#ssh

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementCreated by Linear-GitHub Syncneeds docsRequires documentation updates

    Type

    No type

    Projects

    Status

    Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions