[英]dulwich - clone from remote repo authentication
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"'.
但是,当它们作为关键字 arguments 提供给“dulwich.get-client-from-path()”时,会出现“未知参数“用户名””的错误。
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.username
和password
语法时,用户名和密码似乎都没有存储在任何地方。git remote -v
).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.git clone https://user:password@example.com/repo.git
的行为不同,后者存储了用户名和密码。porcelain
documentation does not mention the possibility to clone with authentication at all.porcelain
文档根本没有提到通过身份验证进行克隆的可能性。porcelain.clone
does take **kwargs
. porcelain.clone
代码确实需要**kwargs
。
client.get_transport_and_path
.client.get_transport_and_path
。client.get_transport_and_path_from_url
.client.get_transport_and_path_from_url
。HttpGitClient.from_parsedurl
.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
字典中(这可能是 harvin 的答案起作用的原因)。kwargs
dictionary is then passed on again somewhere.kwargs
字典在某个地方再次传递。 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.kwargs
中的username
和password
密钥这一事实足以证明我可以尝试我在上面发布的代码段,并且它有效。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.