【问题标题】:push -u origin master does not work - Invalid username or passwordpush -u origin master 不起作用 - 用户名或密码无效
【发布时间】:2020-02-27 10:18:47
【问题描述】:

我是 Github 上的新手,正在尝试将我的第一个 master 分支推送到我的远程存储库。

在 Git bash 中,我输入了 git remote add origin https://github/...

但是当我第一次输入git push -u origin master时,我在弹窗中输入了错误的用户名和密码..T^T

然后,它就给了我

remote: Invalid username or password.

fatal: Authentication failed for 'https://github/...'

所以我尝试使用

git remote set-url origin https://github/... 又是git push -u origin master

但它向我显示了相同的错误消息..

我该如何解决这个问题?

【问题讨论】:

  • 您在 Windows 上工作吗?打开凭据管理器并删除https://github/...的条目。
  • @ElpieKay 哇,它确实有帮助!谢谢,但我又遇到了一个错误.. To https://github/... ! [rejected] master -> master (fetch first) error: failed to push some refs to 'https://github/...' hint: Updates were rejected because the remote contains work that you do hint: not have locally. This is usually caused by another repository pushing hint: to the same ref. You may want to first integrate the remote changes hint: (e.g., 'git pull ...') before pushing again. hint: See the 'Note about fast-forwards' in 'git push --help' for details.
  • stackoverflow.com/questions/28429819/…。您可以在下一次推送之前运行git fetch origin mastergit fetch origin -r master

标签: git github


【解决方案1】:

您应该尝试删除:Windows 上的凭据管理器

  1. 打开控制面板。
  2. 点击用户帐户。
  3. 单击凭据管理器。
  4. 单击 Windows 凭据选项卡(或 Web 凭据)。
  5. 选择Github账号
  6. 点击删除按钮。
  7. 删除 Windows 凭据
  8. 点击是按钮。
  9. 再次尝试输入帐号和密码

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2012-04-21
    • 2011-08-07
    • 1970-01-01
    • 2023-03-16
    • 2018-07-30
    • 2020-07-30
    • 1970-01-01
    相关资源
    最近更新 更多