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

request: use logged in account credentials for commit #9375

Open
spaceunifyfifty opened this issue Jul 27, 2024 · 2 comments
Open

request: use logged in account credentials for commit #9375

spaceunifyfifty opened this issue Jul 27, 2024 · 2 comments
Labels
enhancement a request to improve CLI needs-user-input

Comments

@spaceunifyfifty
Copy link

spaceunifyfifty commented Jul 27, 2024

A major reason why I am using gh cli is to avoid having to manually setup ssh keys and git config user.name/email entries because I deal with many github accounts and this is tedious.

gh allows me to clone private repositories under the correct account, but after I make contributions and am ready to commit and push, git commit uses my git global config email and name which is not necessarily correct for the account I am currently logged into in gh.

I don't want to go setup repository specific configs for every single project / account. gh should just ship with a way to use your gh logged in credentials when committing.

@spaceunifyfifty spaceunifyfifty added the enhancement a request to improve CLI label Jul 27, 2024
@cliAutomation cliAutomation added the needs-triage needs to be reviewed label Jul 27, 2024
@spaceunifyfifty spaceunifyfifty changed the title use logged in account credentials for commit [request]: use logged in account credentials for commit Jul 27, 2024
@spaceunifyfifty spaceunifyfifty changed the title [request]: use logged in account credentials for commit request: use logged in account credentials for commit Jul 27, 2024
@williammartin
Copy link
Member

Thanks for the feedback. This seems to share a lot of requested behaviour with #8590 and linked issues within but maybe it's slightly different.

Would it be sufficient if gh modified your git config when you auth login or auth switch, or are you asking for some way that git could hook into gh to fill the commit info?

@williammartin williammartin added needs-user-input and removed needs-triage needs to be reviewed labels Jul 27, 2024
@spaceunifyfifty
Copy link
Author

spaceunifyfifty commented Jul 27, 2024

Would it be sufficient if gh modified your git config when you auth login or auth switch

I would be fine with that, yes. Just so long as I never have to go manually nano into a config file ever or copy paste the result of ssh-keygen ever again. I am willing to make sure I always use gh to switch into the correct account before committing/pushing, if I can trust that gh has modified the git config already with zero config needed from me.

or are you asking for some way that git could hook into gh to fill the commit info?

This is interesting too, if it were feasible for git to detect if gh is activated on the user's machine and maybe prompt whether to defer to it. Seems like that's a less likely solution.

Or perhaps helper functions/aliases for gh like gh push, gh commit that internally call git commit, git push but with the correct gh credentials somehow?

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 needs-user-input
Projects
None yet
Development

No branches or pull requests

3 participants