使用用户名和密码的Python github Pull

时间:2020-10-26 07:17:28

标签: python git ubuntu github

我正在使用用户名和密码在python中制作用于git pull的应用程序。我已经在本地克隆了github仓库。现在,我想每次由不同的用户使用python拉,因为他们需要每次输入用户名和密码。例如,如果我在终端上应用github命令:

git pull origin master

它询问用户名和密码(这是我目前正在使用python进行的操作),它将拉出所有最近的提交。

enter image description here

我正在按照该教程进行操作,但是它说要配置(如果我没记错的话)将保存所有信息的方法。此外,它创建了一个新的存储库,而我的存储库已经存在,就像我已经克隆的一样。 教程:

https://www.devdungeon.com/content/working-git-repositories-python

我也关注了这篇文章:

How can I pull a remote repository with GitPython?

这是我在本地Github目录中,该目录是我通过终端克隆的:

[enter image description here] [

在网站上:

enter image description here

对不起,英语不好。我需要帮助来了解这种现象。

1 个答案:

答案 0 :(得分:1)

您需要在存储库的.git / config或〜/ .git-credentials文件中设置用户名和密码。这是一个链接,该链接以多种方式帮助我。

https://www.shellhacks.com/git-config-username-password-store-credentials/

相关问题