Skip to content

gh repo clone should resolve paths too #8725

Description

@oriongonza

Describe the feature or problem you’d like to solve

gh repo clone https://github.com/cli/cli/tree/trunk/internal should clone cli/cli

Proposed solution

I'm often exploring a repo in github and I want to actually copy it locally so I copy the url and paste it into git clone then remove the paths. It would be nice if I could skip that step.

Activity

  1. added
    gh-reporelating to the gh repo command
    and removed on Feb 23, 2024
  2. williammartin commented on Feb 23, 2024

    @williammartin
    Member

    Hey @dev-ardi, thanks for explaining your workflow here, I understand when this would be handy. I suppose the only time this might be confusing would be if the directory happened to be pointing to a submodule but that doesn't seem like a big deal.

    I've marked this help wanted if you're interested in contributing it.

  3. oriongonza commented on Feb 23, 2024

    @oriongonza
    Author

    If I wanted to do this, where should I start? Any concrete file to give me a heads up?

  4. williammartin commented on Mar 1, 2024

    @williammartin
    Member

    Well, the most correct solution might be to change the FromURL function however that's going to impact a lot of commands and I don't have the foresight right now to know what the consequence of that will be.

    The simplest approach to prove this out would be to strip everything after https://github.com/cli/cli before passing it into FromURL:

    }
    repo, err = ghrepo.FromURL(repoURL)

    Then adding the appropriate tests.

  5. sswastik02 commented on Mar 31, 2024

    @sswastik02

    Is this issue still relevant?
    If yes, I would like to contribute to this.

  6. babakks commented on Apr 26, 2024

    @babakks
    Member

    @williammartin Since it's been a while and there was no activity/PR, I submitted PR #9008 for this.

    And yes, touching FromURL is not a safe approach since it's been used in various places. I've explained a bit more in the PR description.

  7. mollarazib26-prog commented on May 5, 2026

    @mollarazib26-prog
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementa request to improve CLIgh-reporelating to the gh repo commandhelp wantedContributions welcome

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions