【问题标题】:Git asks a password for a wrong URL every-time, whenever I tried to excute git clone,git pull每当我尝试执行 git clone,git pull 时,Git 每次都会询问错误 URL 的密码
【发布时间】:2021-04-07 19:16:42
【问题描述】:

每当我尝试执行 git clone,git pull 时,Git 每次都会询问一个错误 URL 的密码。

在没有任何用户名的情况下按以下格式询问密码。

“http://xxxxxxxxx@192.168.0.23:8080”的密码:

Git 配置

[core]
 repositoryformatversion = 0
 filemode = true
 bare = false
 logallrefupdates = true
 ignorecase = true
 precomposeunicode = true

[user]
 name = manishk

[remote "origin"]
 url = http://xxx.0.23:8080/tfs/DefaultCollection/202006-015-ping/_git/… 
 fetch = +refs/heads/*:refs/remotes/origin/*

【问题讨论】:

  • 你能把git remote -v中显示的内容也发一下吗
  • 它提供了两个用于获取和推送的 url,与上面给出的 url@KarthikNayak 无关
  • 这些是http URL 还是ssh URL?你能告诉我们你的.git/config吗?
  • [core] repositoryformatversion = 0 filemode = true bare = false logallrefupdates = true ignorecase = true precomposeunicode = true [user] name = manishk [remote "origin"] url = xxx.xxx.0.23:8080/tfs/DefaultCollection/202006-015-ping/_git/… fetch = +refs /heads/*:refs/remotes/origin/*@KarthikNayak
  • 那些是 http urls@KarthikNayak

标签: git macos ssh terminal git-config


【解决方案1】:

从您的 git 配置来看,它似乎正在调用指定的 URL。

【讨论】:

    【解决方案2】:

    您的网址格式错误。如果要使用带有端口号的 URL,则需要指定方案。因此,如果您打算将其作为 HTTP URL,您可以这样写:

    $ git remote set-url http://xxx.xxx.0.23:8080/tfs/DefaultCollection/202006-015-ping/_git/
    

    如果这是一个 SSH URL,你应该这样写:

    $ git remote set-url ssh://xxx.xxx.0.23:8080/tfs/DefaultCollection/202006-015-ping/_git/
    

    如果您想使用 SSH 密钥,则必须使用 SSH URL。如果您使用 HTTP 或 HTTPS URL,则通常需要密码。如果您不想每次都被提示输入相同的密码,您可以通过运行git config credential.helper osxkeychain(对于 macOS)来设置凭证助手。这将导致您的密码被保存在提示您输入密码的旁边。

    当然,请注意,通过普通 HTTP(即非 HTTPS、非 SSH)连接发送任何类型的凭据都是不安全的,因此您应该避免这样做。

    【讨论】:

    • 我试过这个 $ git remote set-url xxx.xxx.0.23:8080/tfs/DefaultCollection/202006-015-ping/_git。但它再次要求输入与上面不同的错误 url 的密码,就像这样。 “xxxxxxxxx@192.168.0.23:8080”。 @bk2204
    • 您的网址需要有一个方案(即http://、https:// 或ssh://)。它会在 URL 中提示您输入您的用户名;这是正常的和预期的。它会向您显示提示您输入密码的用户名,以便如果您有多个帐户,则可以输入正确的凭据。
    • 对不起,它在那里 http:// 并且它不是先要求用户名,它直接要求任何随机错误 url 的密码。@bk2204
    猜你喜欢
    • 2021-01-27
    • 2018-02-05
    • 2022-01-25
    • 2012-06-13
    • 1970-01-01
    • 2012-07-09
    • 2015-08-10
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多