Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

GHP Authentication no longer working #1801

Answered by EliahKagan
dorochadev asked this question in Q&A
Discussion options

Hello, this is the code i have been using for quite some time to update my project from github, coming back to my project after some months it appears github may have changed their api, as using ghp token@github.com no longer works, it prompts me for a password, and then states Support for password authentication was removed on August 13, 2021.

could someone please provide me with the correct way to do this?

def clone_and_replace_repository():
 git.Repo.clone_from(f"https://{config['repository']['token']}@github.com/{config['repository']['path']}.git", 'temp_repo')
 for root, dirs, files in os.walk('temp_repo'):
 if '.git' in dirs:
 dirs.remove('.git')
 for file in files:
 src_file = os.path.join(root, file)
 dest_file = os.path.relpath(src_file, 'temp_repo')
 shutil.copy(src_file, dest_file)
 shutil.rmtree('temp_repo')
 print("Repository cloned and files replaced successfully.")
 ```
You must be logged in to vote

Is it possible the token has expired?

Both classic (ghp_) and fine-grained (github_pat_) personal access tokens can still be used to authenticate on GitHub by placing them in a URL as the username field with no password (among other ways).

When an incorrect personal access token is used, I have found that the "Support for password authentication was removed on August 13, 2021" message is sometimes shown, even if the attempted token has the correct form for a PAT, and even if it was a previously issued PAT that can no longer be used.

However, I have not been able to make that message appear with a revoked classic PAT (only with a revoked fine-grained PAT). So maybe something else is going ...

Replies: 1 comment 1 reply

Comment options

Is it possible the token has expired?

Both classic (ghp_) and fine-grained (github_pat_) personal access tokens can still be used to authenticate on GitHub by placing them in a URL as the username field with no password (among other ways).

When an incorrect personal access token is used, I have found that the "Support for password authentication was removed on August 13, 2021" message is sometimes shown, even if the attempted token has the correct form for a PAT, and even if it was a previously issued PAT that can no longer be used.

However, I have not been able to make that message appear with a revoked classic PAT (only with a revoked fine-grained PAT). So maybe something else is going on in how the URL is being made.

You must be logged in to vote
1 reply
Comment options

Apologies, you are correct, i must've messed something up while replacing my old token with the new one.
Thanks!

Answer selected by dorochadev
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
Converted from issue

This discussion was converted from issue #1800 on January 12, 2024 15:23.

AltStyle によって変換されたページ (->オリジナル) /