I couldn't find any resource on this topic. I need to clone from a private repository by providing the username and the password. However when they are provided as keyword arguments to 'dulwich.get-client-from-path()' an error occurs saying 'unknown argument "username"'.
This seems to be a simple thing to do, however I can't find the proper method.
试试这个片段:
porcelain.clone("https://user:password@your_git_repo.git")
This works as well:
porcelain.clone("https://example.com/repo.git", username="user", password="password")
I quickly checked to see if the credentials are stored locally:
username
and password
syntax from this answer, neither username nor password seem to be stored anywhere.git remote -v
). The password does not seem to be stored.
git clone https://user:password@example.com/repo.git
on the command line, which stores both username and password.porcelain
documentation does not mention the possibility to clone with authentication at all.porcelain.clone
does take **kwargs
.
client.get_transport_and_path
.client.get_transport_and_path_from_url
.HttpGitClient.from_parsedurl
. If username and password are present in the URL, they are extracted and stored into the kwargs
dictionary (this probably is what makes harvin's answer work).kwargs
dictionary is then passed on again somewhere. I did not check that location out, because the fact that the code knows about a username
and a password
key in kwargs
was enough evidence for me to just try the snippet I posted above, and it worked.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.