Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support different default OWNER in gh repo clone REPO #2000

Open
Moser-ss opened this issue Sep 27, 2020 · 8 comments · May be fixed by #9044
Open

Support different default OWNER in gh repo clone REPO #2000

Moser-ss opened this issue Sep 27, 2020 · 8 comments · May be fixed by #9044
Labels
enhancement a request to improve CLI gh-repo relating to the gh repo command help wanted Contributions welcome

Comments

@Moser-ss
Copy link

Describe the feature or problem you’d like to solve

The feature to have the authenticated user as default OWNER when clone the repo is very neat, but for some people that could not be enough. For example for people that work a lot inside of a specific organization could be nice to set a different default owner

Proposed solution

using the gh config we could set a default owner, like gh config owner acme

Then every time we use the gh repo clone we don't need to specify the owner

@Moser-ss Moser-ss added the enhancement a request to improve CLI label Sep 27, 2020
@Kamarulzamansalehudin

This comment has been minimized.

@vilmibm vilmibm added the core This issue is not accepting PRs from outside contributors label Sep 29, 2020
@vilmibm
Copy link
Contributor

vilmibm commented Sep 29, 2020

I definitely see the merits in this for folks using GH at work under a single organization; I'm marking as core since I want us internally to discuss if a new config option is right for this.

@reinoudk
Copy link

reinoudk commented May 6, 2021

I would love for this to be configurable using an environment variable (as well). My use case is that I'm a member of multiple organizations and the directory structure on my machine mirrors that of the host/owner/repo format. This allows me to set the appropriate environment variables using direnv. I can already set GH_REPO and GH_HOST, but not GH_OWNER, which is the last missing piece.

@maaslalani
Copy link

I'd like to +1 this issue. I love the idea of having a fallback organization from which to clone repos, i.e. if I run gh clone repo_name and that repo does not exist on my account but it is found on the (fallback) organization, it could clone from there.

@vilmibm vilmibm added the discuss Feature changes that require discussion primarily among the GitHub CLI team label Mar 1, 2023
@vilmibm
Copy link
Contributor

vilmibm commented Mar 7, 2023

We're cool with a new config added for this.

Let's call it default_owner. If it's unset, behavior is the same as right now. If it's set, it's used in repository lookups.

@vilmibm vilmibm added help wanted Contributions welcome and removed core This issue is not accepting PRs from outside contributors discuss Feature changes that require discussion primarily among the GitHub CLI team labels Mar 7, 2023
@shadowrotty

This comment was marked as spam.

@spookyuser
Copy link

A hack but this works for me rn:

gh alias set clone 'repo clone INSERT_USER_HERE/"$1"'

Then you can do

gh clone whatever

@samcoe samcoe added the gh-repo relating to the gh repo command label Oct 2, 2023
@maaslalani maaslalani linked a pull request May 3, 2024 that will close this issue
@maaslalani
Copy link

Made a PR that would query for the repository in the user's organizations as a fallback, this would solve my problems for this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement a request to improve CLI gh-repo relating to the gh repo command help wanted Contributions welcome
Projects
None yet
Development

Successfully merging a pull request may close this issue.

9 participants