{"thread":{"id":"61805","subject":"Bug","startedAt":"2024-07-18T19:11:06Z","lastAt":"2024-07-18T21:34:14Z","messageCount":2,"participants":["Jeffrey Barish","brian m. carlson"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"498935","messageId":"CAKjFfK_vcD-36LqYDMfEEjMARGQKFMQbKH7GqUPzrEjU-_HuQw@mail.gmail.com","threadId":"61805","inReplyTo":null,"subject":"Bug","fromName":"Jeffrey Barish","fromEmail":"jeffbarish73@gmail.com","sentAt":"2024-07-18T19:10:54Z","receivedAt":"2024-07-18T19:11:06Z","isPatch":false,"sender":{"key":"jeffbarish73@gmail.com","avatar":null},"body":"-- \nJeffrey Barish\n\n\nThank you for filling out a Git bug report!\nPlease answer the following questions to help us understand your issue.\n\nWhat did you do before the bug happened? (Steps to reproduce your issue)\n\nI did:\n<create a new repository>\ngit init\ngit add .\ngit commit -m \"Initial commit\"\ngit remote add origin https://github.com/jeffbarish/wax\ngit push -u origin master\n\nWhat did you expect to happen? (Expected behavior)\n\nI expected my files to get pushed to my repository.\n\nWhat happened instead? (Actual behavior)\n\nI got a popup window demanding a password for a username that appears to be a random string of characters.\n\nWhat's different between what you expected and what actually happened?\n\nThe files should be transferred, or, at worst, I should get a request for a password for username jeffbarish\n\nAnything else you want to add:\n\nI am prepared to delete my account and start over, but I do not see a way to do that. In any case, I wonder whether there is a better solution.\n\nPlease review the rest of the bug report below.\nYou can delete any lines you don't wish to share.\n\n\n[System Info]\ngit version:\ngit version 2.43.0\ncpu: x86_64\nno commit associated with this build\nsizeof-long: 8\nsizeof-size_t: 8\nshell-path: /bin/sh\nuname: Linux 6.8.0-38-generic #38-Ubuntu SMP PREEMPT_DYNAMIC Fri Jun  7 15:25:01 UTC 2024 x86_64\ncompiler info: gnuc: 13.2\nlibc info: glibc: 2.39\n$SHELL (typically, interactive shell): /bin/bash\n\n\n[Enabled Hooks]\n"},{"id":"498943","messageId":"ZpmKU60benuHLXmA@tapette.crustytoothpaste.net","threadId":"61805","inReplyTo":"CAKjFfK_vcD-36LqYDMfEEjMARGQKFMQbKH7GqUPzrEjU-_HuQw@mail.gmail.com","subject":"Re: Bug","fromName":"brian m. carlson","fromEmail":"sandals@crustytoothpaste.net","sentAt":"2024-07-18T21:34:11Z","receivedAt":"2024-07-18T21:34:14Z","isPatch":false,"sender":{"key":"sandals@crustytoothpaste.net","avatar":"https://avatars.githubusercontent.com/u/497054?v=4"},"body":"On 2024-07-18 at 19:10:54, Jeffrey Barish wrote:\n> -- \n> Jeffrey Barish\n\n> Thank you for filling out a Git bug report!\n> Please answer the following questions to help us understand your issue.\n> \n> What did you do before the bug happened? (Steps to reproduce your issue)\n> \n> I did:\n> <create a new repository>\n> git init\n> git add .\n> git commit -m \"Initial commit\"\n> git remote add origin https://github.com/jeffbarish/wax\n> git push -u origin master\n> \n> What did you expect to happen? (Expected behavior)\n> \n> I expected my files to get pushed to my repository.\n> \n> What happened instead? (Actual behavior)\n> \n> I got a popup window demanding a password for a username that appears to be a random string of characters.\n> \n> What's different between what you expected and what actually happened?\n> \n> The files should be transferred, or, at worst, I should get a request for a password for username jeffbarish\n> \n> Anything else you want to add:\n> \n> I am prepared to delete my account and start over, but I do not see a way to do that. In any case, I wonder whether there is a better solution.\n\nI'm not exactly sure what's happening, but I have some guesses.  I think\nthere's somewhere where you provided a personal access token as a\nusername.  While that works on GitHub, it's not the recommended\napproach, because, as you've just seen, Git prints the personal access\ntoken as plaintext since it thinks it's the username.  If the token\nstarts with `ghp_` (or `gh?_`, where `?` can be any character), then\nthis is probably the case.\n\nTo determine where that comes from, you can look at `git config -l\n--show-origin` to see if you've set some sort of `insteadOf` setting\nthat rewrites the credential into the username.  If so, you probably\nwant to remove that, and instead store it in a credential helper, since\nthe configuration isn't a secure way to store secrets.\n\nIt could also be that the data is stored in your credential helper as\nthe username.  You can see what the credential protocol has to say about\nthis with the following command (I recommend piping it to `less` so as\nnot to leave the password in your terminal):\n\n  printf 'capability[]=authtype\\nurl=https://github.com/jeffbarish/wax\\n' | GIT_TERMINAL_PROMPT=0 git credential fill\n\nIf the string of characters is in the username and not in the password,\nthen that would explain why you're being prompted for that.  To fix\nthat, you can take the same output, change the username field to\n\"jeffbarish\", change the password field to your token, and then pipe\nthat to \"git credential approve\".  That should set the right data in\nyour credential manager.\n\nThat might also bring up the prompt window you've seen before.  In that\ncase, you may change the right side of the pipe to this:\n\n  env -u DISPLAY -u WAYLAND_DISPLAY GIT_TERMINAL_PROMPT=0 git credential fill\n\nThat will prevent any sort of UI command being run.\n\nIf you want to just erase credentials from your credential manager, then\nyou can do that with this:\n\n  echo url=https://github.com | git credential reject\n\nThen, the next time you're prompted for credentials, enter your username\nas \"jeffbarish\" and generate a personal access token from the GitHub\nwebsite (in Settings → Developer Tools) and paste that in for the\npassword.  Don't use your actual GitHub password because GitHub doesn't\nallow pushing with a username and password.  However, if you're using\nGit Credential Manager Core as your credential helper, it _will_ ask you\nfor your password to do an OAuth request and issue a token automatically\nthat way, and then you do need your actual password and 2FA information.\n-- \nbrian m. carlson (they/them or he/him)\nToronto, Ontario, CA\n"}]}