A password is suddenly asked on my token access to github, and even the error message quote it as outdated. #68516
Replies: 10 comments 11 replies
This comment was marked as off-topic.
This comment was marked as off-topic.
-
|
I am sorry but I don't understand this at all. I am locked out of imporntant Repos suddenly late at night with the same message: I have absolutely no idea, why that message is suddenly displayed (the token was previously stored in the credential manager). The linked URL in that error message is completely unhelpful. The link to the documentation you attached is also completely unhelpful. I have my ssh key even setup in GitHub. I know ssh. I have my PAT stored in an environment variable. Yet my workflow/muscle memory is still with https clone/remotes. If you break workflows, please give us a simple step to fix this (e.g.: "enter these 3 commands to switch to ssh remote or enter these 3 commands to setup your git credential store newly"). I have to search for random Stackoverflow Threads on Google to fix this (still unsuccessfully ) because i have no idea from the error message why I suddenly can't access my repos anymore and what the solution is. Not cool! |
Beta Was this translation helpful? Give feedback.
This comment was marked as off-topic.
This comment was marked as off-topic.
-
|
Hey there! 👋 Thanks for posting in the GitHub Community, @ThibauldMichel! We're happy you're here. You are more likely to get a useful response if you are posting your question in the applicable category. The Accessibility category is a place for our community to discuss and provide feedback on the digital accessibility of GitHub products. Digital accessibility means that GitHub tools, and technologies, are designed and developed so that people with disabilities can use them. Also, if you did receive an answer to your question here, I would encourage you to mark the response as the answer so that it can help others who have similar questions find the answer in the future. I've gone ahead and moved this to the correct category for you. Good luck! |
Beta Was this translation helpful? Give feedback.
-
|
Useless Responses!!! |
Beta Was this translation helpful? Give feedback.
-
|
remote: Support for password authentication was removed on August 13, 2021. can someone give me the correct steps to solve this issue? |
Beta Was this translation helpful? Give feedback.
-
|
POSSIBLE SOLUTION When you asked for:
This is not a password — it's a personal access token. At least in my case 🙈 |
Beta Was this translation helpful? Give feedback.
-
|
I also have been confronted by this 'password' request this week ... even though the PAT was created in April 2024 with no exp date ... hmmm. I created another github PAT with exp date six months out. To fix, locally, for me: |
Beta Was this translation helpful? Give feedback.
-
|
🕒 Discussion Activity Reminder 🕒 This Discussion has been labeled as dormant by an automated system for having no activity in the last 60 days. Please consider one the following actions: 1️⃣ Close as Out of Date: If the topic is no longer relevant, close the Discussion as 2️⃣ Provide More Information: Share additional details or context — or let the community know if you've found a solution on your own. 3️⃣ Mark a Reply as Answer: If your question has been answered by a reply, mark the most helpful reply as the solution. Note: This dormant notification will only apply to Discussions with the Thank you for helping bring this Discussion to a resolution! 💬 |
Beta Was this translation helpful? Give feedback.
-
|
TL;DR: You can presently use the following to authenticate with a token: # `gha` user can be anything:
git push https://gha:${GITHUB_TOKEN}@github.com/octocat/helloPersistenceThis is more relevant to CI usage where you may not want to persist the credentials to disk to perform various git operations. If you git config --local remote.origin.urlIf you've already got a repo, you can update the remote url like already suggested with GH_CREDENTIALS=$(echo -n "gha:${TOKEN}" | base64 -w0)
git config --local http.https://github.com/.extraheader "AUTHORIZATION: basic ${GH_CREDENTIALS}"
# Credentials are scoped to Github rather than per remote:
git config get --local --url https://github.com http.extraheaderOriginal answerI landed here when trying to perform Various sources implied that this was not supported, it's unclear why official docs don't mention it.
I have found the following to work in a private repo when used in a GHA workflow run: git ls-remote --exit-code --refs --tags --sort='-v:refname' \
https://gha:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.event.repository.full_name }}Compared to the quoted example, the solution uses basic-auth credentials URL ( It's possible that this isn't intended to be supported still, but it does work outside of actions too if you've created a personal token (again the username portion is not relevant, but a username of at least one character is required). While the solution does differ from the alternative forms that were originally blogged (neither considered valid today), the blog does show roughly the same basic-auth syntax support - except the token is treated as the username which the blog explains:
That blog also does warn you about a risk of the token being persisted to disk:
I'm not familiar with if that's only the case with FROM fedora:42
RUN dnf install -qy git
COPY --chmod=500 <<"HEREDOC" /usr/local/bin/run-example
#!/usr/bin/env bash
TOKEN=your-token-here
REPO='owner/repo'
REPO_URL="https://gha:${TOKEN}@github.com/${REPO}"
# No credentials stored:
git ls-remote --exit-code --refs --tags --sort='-v:refname' "${REPO_URL}" > /tmp/results.txt
# Credentials stored at `./example/.git/config`:
git clone "${REPO_URL}" example
HEREDOC
WORKDIR /tmp
RUN run-exampleI used a docker image from the above After the clone, change to the clone dir ( # Show's the specific config entry that persisted the basic-auth URL (plain-text credentials):
git config --local remote.origin.urlNOTE: GitHub Actions # Initialize a new repo
git init
# Add the remote origin without credentials associated to it:
git remote add origin ${{ github.event.repository.html_url }}
# Add the authorization credentials for that remote via basic-auth header, requires base64 encoding:
GH_CREDENTIALS=$(echo -n "gha:${TOKEN}" | base64 -w0)
git config --local http.https://github.com/.extraheader "AUTHORIZATION: basic ${GH_CREDENTIALS}"
# Retrieve the specific line with base64 encoded credentials set (or see full config via `cat .git/config`):
git config get --local --url https://github.com http.extraheader |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Select Topic Area
Question
Body
I have set up my local git to access to Github via access token using this command:
git push https://<GITHUB_ACCESS_TOKEN>@github.com/<GITHUB_USERNAME>/<REPOSITORY_NAME>.git
Until recently it worked well.
But for an unknown reason, a password was asked when I used the same command line yesterday.
Ironically, the error message itself quote this authentication method is outdated.
On branch master
nothing to commit, working tree clean
Password for 'https://<GITHUB_ACCESS_TOKEN>@github.com':
remote: Support for password authentication was removed on August 13, 2021.
remote: Please see https://docs.github.com/en/get-started/getting-started-with-git/about-remote-repositories#cloning-with-https-urls for information on currently recommended modes of authentication.
fatal: Authentication failed for 'https://github.com/<GITHUB_USERNAME>/<REPOSITORY_NAME>.git/
So my questions are:
Beta Was this translation helpful? Give feedback.
All reactions