Skip to content

gh repo fork adds remote using https protocol even if repository was cloned through ssh #1056

@thomaseizinger

Description

@thomaseizinger

Describe the bug

Cloning a repository through ssh and forking it adds the fork using the https protocol.

❯ gh --version
gh version 0.9.0 (2020-05-27)
https://github.com/cli/cli/releases/tag/v0.9.0

Steps to reproduce the behavior

  1. Make a temp directory: cd $(mktemp -d)
  2. Clone a repository via ssh: gh repo clone git@github.com:cli/cli.git
  3. Navigate into the repository: cd cli
  4. Fork the repository: gh repo fork --remote=true
  5. List all remotes: git remote -v

Expected vs actual behavior

Expected behaviour

The new fork uses the ssh protocol because the repo was originally cloned through that.

Actual behaviour

The fork was added using the https protocol:

❯ git remote -v
origin	https://github.com/thomaseizinger/cli.git (fetch)
origin	https://github.com/thomaseizinger/cli.git (push)
upstream	git@github.com:cli/cli.git (fetch)
upstream	git@github.com:cli/cli.git (push)

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingpriority-3Affects a small number of users or is largely cosmetic

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions