【问题标题】:Python github Pull using username and passwordPython github 使用用户名和密码拉取
【发布时间】:2020-11-26 00:55:15
【问题描述】:

我正在使用用户名和密码在 python 中为 git pull 制作应用程序。我已经在本地克隆了 github 存储库。现在我想每次使用 python 由不同的用户拉,因为他们每次都需要输入用户名和密码。例如,如果我在终端上应用 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 目录:

[][

在网站上:

抱歉英语不好。我需要帮助来理解这种现象。

【问题讨论】:

  • 你应该考虑使用SSH authentication
  • @KlausD。你不是说python吗?
  • Python 与底层 git 身份验证无关。

标签: python git ubuntu github


【解决方案1】:

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

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

【讨论】:

  • 感谢 bt 我在探索了一整周后取得了成功。 :)
猜你喜欢
  • 2011-09-16
  • 2020-05-24
  • 2012-08-24
  • 2011-05-27
  • 1970-01-01
  • 1970-01-01
  • 2015-05-31
  • 2016-07-05
  • 2012-06-16
相关资源
最近更新 更多