推送分支时出现 git 错误:身份验证失败:意外令牌')'附近出现语法错误



在 git 中,当尝试将分支从我的本地机器推送到源时,我正在使用以下命令:

git push origin MSMQtoAzure

然后,系统会提示我输入我的 VSO 用户 ID 和密码。 我知道信条是有效的,因为我一直在使用它们。 但是,我在命令提示符下得到这个:

fatal: Authentication failed for <url>
bash: command substitution: line 1: syntax error near unexpected token ')'
bash: command substitution: line 1: '__git_ps1)'

这是我的git.config文件的全部内容(删除了一些敏感部分)

[core]
    bare = false
    filemode = false
    symlinks = false
    ignorecase = true
    logallrefupdates = true
[core]
    repositoryformatversion = 0
[remote "origin"]
    url = https://<redacted>.com/defaultcollection/Response%20(Git)/_git/Main
fetch = +refs/heads/*:refs/remotes/origin/*
[remote "origin"]
[branch "master"]
    remote = origin
[branch "master"]
    merge = refs/heads/master
[branch "LeadSubmission"]
    remote = origin
[branch "LeadSubmission"]
    merge = refs/heads/LeadSubmission
[gui]
    wmstate = normal
    geometry = 887x427+1984+334 369 192
[branch "ChangeXToY"]
    remote = origin
[branch "ChangeXToY"]
    merge = refs/heads/ChangeXToY
[branch "MSMQtoAzure"]
    remote = origin
[branch "MSMQtoAzure"]
    merge = refs/heads/MSMQtoAzure

编辑:

我的密码中有一个 $ 符号。 这可能是问题所在吗? 我试图逃避它。 假设密码是 123$456。 我已经尝试了以下所有方法:

  • 123/$456
  • 123\$456
  • 123'$456

从 Git 命令提示符使用 VSO Git 存储库时,需要使用个人访问令牌或备用身份验证。

为方便起见,可以安装 Git 凭据管理器。它将提示一个 VSO 登录对话框,然后您可以直接输入您的 VSO 用户名和密码。

最新更新