Skip to content

Unwanted remote naming after gh repo fork #847

@jglick

Description

@jglick

Describe the bug

gh version 0.7.0 (2020-04-22)

gh repo fork renames origin to upstream and sets my fork as origin. I want to retain origin untouched and add an origin named fork.

Steps to reproduce the behavior

I had a clone of an organization repo

$ git remote -v
origin	ssh://git@github.com/org/repo.git (fetch)
origin	ssh://git@github.com/org/repo.git (push)

I forked it

$ gh repo fork
- Forking org/repo...
✓ Created fork jglick/repo
? Would you like to add a remote for the fork? Yes
✓ Renamed origin remote to upstream
✓ Added remote origin
$ git remote -v
origin	git@github.com:jglick/repo.git (fetch)
origin	git@github.com:jglick/repo.git (push)
upstream	ssh://git@github.com/org/repo.git (fetch)
upstream	ssh://git@github.com/org/repo.git (push)

Expected vs actual behavior

I wanted to see

$ gh repo fork
- Forking org/repo...
✓ Created fork jglick/repo
? Would you like to add a remote for the fork? Yes
✓ Added remote fork
$ git remote -v
fork	git@github.com:jglick/repo.git (fetch)
fork	git@github.com:jglick/repo.git (push)
origin	ssh://git@github.com/org/repo.git (fetch)
origin	ssh://git@github.com/org/repo.git (push)

or be prompted.

Workaround

git remote rename origin fork
git remote rename upstream origin

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingpriority-2Affects more than a few users but doesn't prevent core functions

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions