当你做拉/推请求时如何让git bash询问密码?

时间:2017-02-15 13:23:51

标签: git

我在Windows上使用Git Bash。当我做拉/推请求时,git不会要求输入密码,但这是非常必要的。 我怎么能这样做呢?

1 个答案:

答案 0 :(得分:0)

运行git remote -v

如果您的仓库托管在像Github这样的东西上,您应该看到响应:

    origin  git@github.com:username/repo.git (fetch)
    origin  git@github.com:username/repo.git (push)

这意味着您使用的是repo的SSH协议,需要切换到HTTPS:

    git remote set-url origin https://github.com/username/repo.git

如果您自己托管git服务器,这会变得有点复杂。