我正在使用用户名和密码在 python 中为 git pull 制作一个应用程序。我已经在本地克隆了 github 存储库。现在我想每次使用 python 由不同的用户 pull ,因为他们每次都需要输入用户名和密码。例如,如果我在终端上应用 github 命令:
git pull origin master
它询问用户名和密码(这是我目前正在寻找如何在 python 中执行的操作),它会提取所有最近的提交。我正在关注该教程,但它说要配置(如果我没记错的话)将保存所有信息。此外,它创建了一个新的仓库,而我的仓库已经存在,因为我已经克隆了。
教程:
https://www.devdungeon.com/content/working-git-repositories-python
这个帖子我也关注了:
How can I pull a remote repository with GitPython?
这是我通过终端克隆的本地 Github 目录:
[ ][
在网站上:
抱歉英语不好。我需要帮助来理解这种现象。
最佳答案
您需要在存储库的 .git/config 或 ~/.git-credentials 文件中设置用户名和密码。这是一个链接,它帮助我采用了几种方法来做到这一点。
https://www.shellhacks.com/git-config-username-password-store-credentials/
关于Python github 使用用户名和密码 pull ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/64532849/