【问题标题】:Git push prompts for username and password but pull doesn't why?Git push 提示输入用户名和密码,但 pull 不为什么呢?
【发布时间】:2018-07-18 23:23:50
【问题描述】:

我正在使用 Mac Osx,我希望 git pull 在 pull 之前也查询用户名和密码。

我试过了:

git config --global --unset credential.helper

它适用于“git push”但不适用于“git pull”有没有办法同时启用用户名和密码提示?

提前致谢!

【问题讨论】:

  • 为什么需要这个?它不会在拉取时询问,因为存储库(可能)是公开的。
  • @tkausl 非常感谢!它只是一个项目的要求。如果是私有的会提示吗?
  • 问题太不完整。远程是如何配置的?服务器管理员是否设置允许您推送?允许使用 SSH 或 https 协议。

标签: git github gitlab git-push git-pull


【解决方案1】:

(在root用户中)打开控制台并输入:

git config --global --unset credential.helper

我们告诉 git 禁用帮助程序,以避免每次执行这些指令时输入密码。这样,每次我们从存储库中拉取或推送时,都会要求我们输入密码。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2016-01-30
    • 1970-01-01
    • 2018-02-06
    • 1970-01-01
    • 2012-11-08
    • 1970-01-01
    • 2011-11-26
    相关资源
    最近更新 更多