GHP Authentication no longer working
lunarmaniac opened this issue · comments
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.")
```