Python github 使用用户名和密码 pull

标签 python git ubuntu github

我正在使用用户名和密码在 python 中为 git pull 制作一个应用程序。我已经在本地克隆了 github 存储库。现在我想每次使用 python 由不同的用户 pull ,因为他们每次都需要输入用户名和密码。例如,如果我在终端上应用 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
抱歉英语不好。我需要帮助来理解这种现象。

最佳答案

您需要在存储库的 .git/config 或 ~/.git-credentials 文件中设置用户名和密码。这是一个链接,它帮助我采用了几种方法来做到这一点。
https://www.shellhacks.com/git-config-username-password-store-credentials/

关于Python github 使用用户名和密码 pull ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/64532849/

相关文章:

git - 如何对私有(private) jelastic 环境进行版本控制

ubuntu - Vim block 视觉模式插入不起作用

python - 旧版本 Cherrypy 的文档

python - 凯撒密码 仅加密一个字母而不是整个字符串

git - 将 .gitignore 转换为 .hgignore,反之亦然

git 无声地失败,curl https 因非法指令而失败

django - 找出 Django 代码在哪个用户下运行

linux - Swift SQLite Linux/Ubuntu

python - 如何在pyqt5中创建这样的按钮?

python - 使用 macOS Automator 从 conda env 中运行 Python 代码的 Shell 脚本