Repository navigation
Add flag to login command to set name and email in global git config - #6643
samuel-adekunle wants to merge 2 commits into
Conversation
|
@samuel-adekunle Thanks for getting started on this work. I took a look at your PR today and the team decided that, despite what was said in #6096, we would like to see this feature added to the |
|
Hi @samcoe, I would be willing to make that change, however I can't remember if the same approach will work. I'd need to take another look at the commands (it's been a while) and then if I can, I'll add the feature to the setup-git commands. |
|
The
|
|
Any progress with this? I frequently switch accounts and this would make the process so much smoother. |
None so far on my end. |
|
+1 this is a critically essential feature if #326 is ever to become a reality with good |
|
After thinking about this some more and with the lack of movement here I am deciding to close this PR. Thank you @samuel-adekunle for your work and effort on this PR and I apologize that I am going to close it. I think this is mostly a failure on our team not knowing exactly what we wanted when opening the original issue up for contributions. We waffled back and forth between what command this feature should live under and never really came to a consensus. I labeled #6096 as "core" as the team wants to go back to the drawing board to come up with a more thorough plan on bringing this feature to |
Fixes #6096
What have I done
I added a
--set-global-configflag togh auth logincommand which queries the GitHub API for the necessary values and then sets the global git configuser.nameanduser.emailkeys using the retrieved values.I believe that
gh auth loginwas the more natural place to include this functionality rather thangh auth setup-gitbased on their descriptions.Also, I set the default value of the flag to false so it won't unexpectedly change the behaviour of the command.
Testing
I tested the code locally using my own GitHub account and didn't write any additional go tests. This can be easily done by enabling the flag when running the
gh auth logincommand.Things I'm not sure about
According to the docs, the name can be nil and I'm not sure what to do in that case.