r/github • u/hookup1092 • Jul 18 '26
Question I recently had an issue setting up a remote GitHub repository and found a solution for it on Stack Overflow. However, I can't find where this info is mentioned in GitHub's own docs. Does anyone know where this is referenced?
Here is a link to the Stack Overflow comment.
I wasn't able to find where this is mentioned in GitHub's own docs as an option for setting up a remote repository. Specifically this format here for setting up the remote URL for a repo:
https://[TOKEN]@github.com/[REPO-OWNER]/[REPO-NAME]
Right now the solution feels kind of like a magic workaround, which I generally try to avoid. I'd much rather read up and bookmark an official source that talks about this for future reference.
Thank you to anyone who can help! Much appreciated. Apologies if it’s obvious, I’m not very experienced with GitHub.
3
u/wallstop-dev Jul 18 '26
Does this not work? https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/managing-your-personal-access-tokens#using-a-personal-access-token-on-the-command-line
But that's wild, I've never seen that format of auth before (token@github.com) and can't find it anywhere in the docs.
5
u/iamkiloman Jul 18 '26 edited Jul 18 '26
This is just a standard https URI with your token in the userinfo portion of the authority. Token will be sent via basic auth as the username, with no password.
https://datatracker.ietf.org/doc/html/rfc3986#section-3.2
As far as standards go... it's just an update of rfc1738 from 1994, which just documented behavior that was already in wide use even further back.
As far as use with github... It's generally considered less preferable than connecting over ssh, but it'll do.
1
u/cyb3rofficial Jul 18 '26
It was mentioned here https://github.blog/news-insights/easier-builds-and-deployments-using-git-over-https-and-oauth/
1
u/lajawi Jul 18 '26
May I ask why use an access token and not just SSH or HTTPS?