it works for me when using github access token instead of username and password where 2FA may be required:

HTTPS_REMOTE_URL = 'https://<access_token>:[email protected]/username/private-project'

Answer from shawnzhu on Stack Overflow
🌐
Stack Overflow
stackoverflow.com › questions › 62152834 › whats-the-correct-way-to-pass-token-with-git-clone-using-pypi
python - What's the correct way to pass token with git clone using PyPi? - Stack Overflow
1 Python script to git clone without entering a password at the prompt · 6 clone the git repository non-interactively by passing token in the command
🌐
Medium
kettan007.medium.com › how-to-clone-a-git-repository-using-personal-access-token-a-step-by-step-guide-ab7b54d4ef83
How To Clone a Git Repository Using Personal Access Token: A Step-by-Step Guide | by Ketan Gupta | Medium
July 16, 2024 - Navigate to the Directory Where ... Access Token Execute the following command, replacing <PAT> with your copied Personal Access Token, and <repository-url> with the URL of the Git repository you wish to clone:...
🌐
DEV Community
dev.to › nisevi › script-for-cloning-repositories-4h4m
Python script for cloning repositories - DEV Community
July 28, 2020 - So for not having to clone the ... wrote a Python 3 script for doing it for me: The name of the organization is the GitHub username. So for example Facebook GitHub URL is https://github.com/facebook, if you would like to clone all their repositories you will have to replace organization-name-goes-here with facebook. If you don't know how to create a personal access token, click the ...
🌐
CodePal
codepal.ai › code generator › python git clone repository with token authentication and search changed files
Python Git Clone Repository with Token Authentication and Search Changed Files - CodePal
November 24, 2023 - The code provided demonstrates how to achieve this using subprocess module in Python. By following this tutorial, you will be able to efficiently clone repositories, authenticate with tokens, and extract the list of .js files that were changed in the last merge request. ... def clonerepositorywithtoken(repourl: str, token: str): “”“ Clones a repository in Git using token authentication.
🌐
GitHub
github.com › mazen160 › GithubCloner
GitHub - mazen160/GithubCloner: A script that clones Github repositories of users and organizations. · GitHub
Clone authenticated repositories that the authenticated user has access to. ./githubcloner.py -o /tmp/output --authentication user:token --include-authenticated-repos · Include gists. ./githubcloner.py --user user -o /tmp/output --include-gists ...
Starred by 426 users
Forked by 125 users
Languages   Python
🌐
Readthedocs
gitpython.readthedocs.io › en › stable › tutorial.html
GitPython Tutorial — GitPython 3.1.46 documentation
And of course, there is much more you can do with this type, most of the following will be explained in greater detail in specific tutorials. Don’t worry if you don’t understand some of these examples right away, as they may require a thorough understanding of git’s inner workings. ... assert os.path.isdir(cloned_repo.working_tree_dir) # Directory with your work files.
🌐
Reddit
reddit.com › r/git › how to clone a private organization repo using a personal git token using git clone command
r/git on Reddit: How to clone a private organization repo using a personal git token using git clone command
September 1, 2023 -

Hi all,

I am part of an organization, and I have created a personal git token,

Now I want to clone a repo from my organization using my git token,

currently I and doing some thing like this
git clone https://your-username:your-token@github.com/organization-name/your-private-repo.git

but this does not seem to work

can you pls suggest how to clone using git clone command using token only
I am not doing ssh because of some reasons

can you pls suggest

thankyou

Find elsewhere
🌐
Readthedocs
geo-python-site.readthedocs.io › en › latest › lessons › L2 › git-basics.html
Meet Git - Geo-Python - Read the Docs
October 20, 2022 - On the command line this action is equivalent to the git clone command. ... Pay attention to which folder you are in! Git will create a new folder under the folder you are located in when cloning a repo. Git needs to know who you are in order to give you access to remote repositories. Insert your GitHub username and personal access token:
🌐
CopyProgramming
copyprogramming.com › howto › cloning-a-private-repo-using-https-with-gitpython
Python: Using GitPython to Clone a Private Repository via HTTPS
April 8, 2023 - Generate a token and utilize it as the authentication key. git clone https://username:token@github.com/blah/blahblah.git
🌐
Medium
pythononpow.medium.com › howto-use-github-tokens-on-the-command-line-995422c06f00
Howto use github tokens on the command line - Klaas (khz) - Medium
August 16, 2021 - Howto setup a personal access token on github, adapt your local repos and clone new private repos with token based authentication.
🌐
GitHub
github.com › ezbz › gitlabber › issues › 97
Use access token to clone repo · Issue #97 · ezbz/gitlabber
March 9, 2022 - Is your feature request related to a problem? Please describe. Currently using --method http results in getting a question for username / password. Within GitLab it is however possible to use the access token (assuming it has read_repository permissions) to clone the repo.
🌐
Graphite
graphite.com › guides › git-clone-with-token
Cloning a Git repository using a GitHub token - Graphite
This guide details the process of using a token to clone a repository using Git.
🌐
Educative
educative.io › answers › how-to-clone-a-private-repository-from-github
How to clone a private repository from GitHub
Copy the token generated and use it with this command. git clone https://<pat>@github.com/<your account or organization>/<repo>.git
🌐
Accuweb
accuweb.cloud › home › how to clone a private repo using a personal access token (pat)?
How to clone a Private Repo using a Personal Access Token (PAT)?
May 27, 2024 - A Personal Access Token replaces your GitHub password and is required for cloning private repositories over HTTPS. Obtain the repository URL: Navigate to the private repository on your Git hosting platform (like GitHub or GitLab).
🌐
UbiOps
ubiops.com › docs › howto › howto-load-from-git
UbiOps Technical Documentation - Load your libraries from Git
Click the "Generate token" button at the bottom of the page. GitHub will generate an access token for you. Make sure to copy and save the token in a secure place, as it will be displayed only once. Once you navigate away from the page, you won't be able to access the token again. Treat it like a password. This is how the clone_from() command ...