如何解决 Bitbucket 上的这个无效凭据问题?

我的 Bitbucket 密码是正确的,因为我可以很容易地用这个密码登录。当我尝试将一个项目或文件推到 Bitbucket 时,它会显示 “无效凭据错误”

git push -u origin master


fatal: Invalid credentials
Password for 'https://username@bitbucket.org':
remote: Bitbucket Cloud recently stopped supporting account passwords for Git authentication.
remote: See our community post for more details: https://atlassian.community/t5/x/x/ba-p/1948231
remote: App passwords are recommended for most use cases and can be created in your Personal settings:
remote: https://bitbucket.org/account/settings/app-passwords/
fatal: Authentication failed for 'https://bitbucket.org/username/demo.git/'

我怎样才能解决这个问题?

63605 次浏览
  • 转到 网站: http://www.techradar.com/uk/news/what-is-windows-Credential-ManagerWindows Credentials→ < em > 添加通用证书

  • 填满田野:

    • 网络地址: git:https://bitbucket.org
    • 用户名:
    • 应用程序密码:

this question解决了这个问题。

当提示您登录时,使用您的用户名,但不要使用您通常的帐户密码,使用应用程序密码:

获取应用程序密码

  1. 登录 bitbucket. org 网站
  2. 从左下角的虚拟化身,单击 个人设置
  3. 单击 访问管理下的 应用程序密码
  4. Create app password
  5. 给予应用程序密码足够的权限,以及一个与使用该密码的应用程序相关的标签
  6. 别忘了保存密码

For Mac users:

cd Library/Application\ Support/SourceTree

Delete your username here.

你可以再次登录。

成功创建应用程序密码为 阿斯拉夫 · 阿里芬提到的后:

要通过 HTTPS 使用 Bitbucket“ App Password”,然后可以在 晚期中导航到特定存储库的路径,然后设置远程原点(对于已经克隆的存储库) :

git remote set-url origin https://<Bitbucket_Username>:<App_Password>@bitbucket.org/<Bitbucket_Username>/<Repo_Name>.git

对于一个新的克隆:

git clone https://<Bitbucket_Username>:<App_Password>@bitbucket.org/<Bitbucket_Username>/<Repo_Name>.git

enter image description here

2022年3月1日之后:

从2022年3月1日开始,当使用 Bitbucket Cloud REST API 或 Git over HTTPS 进行基本身份验证时,您将不再能够使用 Atlassian 帐户密码。

  1. 转到: 个人设置,应用程序密码
  2. 创建应用程序密码
  3. Tick the necessary permissions for your needs. Account and 仓库 and 写作 are needed for basic Git actions.
  4. 保存密码 你不能再看了
  5. 使用生成的密码登录。您可能需要使用您的 Bitbucket 用户名,您可以在 个人设置,账户设置上找到“ Bitbucket 配置文件设置”(看到一个帖子,专门告诉使用 用户名不知道它是真的)。

更多关于应用程序密码的信息在 应用程序密码上。

嗯,我的答案只是一个 Mikk-Raudsepp 阿尼什回答的汇编。他们是真正的 MVP:

  1. 转到: < em > < a href = “ https://bitbucket. org/account/sets/App-password/”rel = “ noReferrer”> 个人设置,应用程序密码

  2. 创建应用程序密码

  3. 为您的需要勾选必要的权限。

  4. 复制生成的密码

  5. 在航站楼

    在一个已经克隆的项目上:

     git remote set-url origin https://<Bitbucket_Username>:<App_Password>@bitbucket.org/<username/repoName>.git
    

    克隆一个新项目:

     git clone https://<Bitbucket_Username>:<App_Password>@bitbucket.org/<username/RepoName>.git
    

Why is it happening? -

从2022年3月1日开始,您将不再能够使用您的 对象使用基本身份验证时使用 Atlassian 帐户密码 Bitbucket 云 REST API 或 Git over HTTPS。

如果任何 Linux 用户面临同样的问题,请遵循下面给出的步骤。

  1. 转到 Bitbucket. org
  2. 点击 Login link
  3. 在左下角,点击你的头像 偶像(你的个人资料图片)。
  4. 然后单击 Personal settings或者直接打开 Personal settings, Account settings
  5. 访问管理部分,单击 应用程序密码链接或者您可以直接转到 个人设置,应用程序密码
  6. 点击 Create App password按钮。
  7. 根据您的要求提供访问权限。
  8. 点击 Create
  9. 你会弹出一个密码。将密码复制到你的笔记本电脑或个人电脑的某个地方(给定的密码很难记住)。
  10. 现在,无论何时执行 Git 操作,比如 pull 或 push,以及他们是否要求输入密码。您需要使用上述密码(由应用程序密码生成的密码) ,而不是使用您的登录密码。

如果使用 Android Studio,通过添加新生成的应用程序密码来编辑 Git 远程 URL (通过 Git/Manage Remotes)

https://<Bitbucket_Username>: < App _ Password > @bitbucket.org/<Repo_Name>.git

如果安装后仍有错误:

应用程序密码

更新 设置远程存储库路径:

https://<Bitbucket_Username_not_email>:<App_Password_not_old_password>@bitbucket.org/<Full_Repo_Name_Path>.git

我的 JetBrains IDE 也有同样的问题。 当我尝试更新项目源代码或推送提交时,它显示了一个密码对话框。

enter image description here

我按照下面的步骤解决了这个问题

  • 在 Bitbucket 上打开个人设置的 应用程序密码页面 enter image description here
  • Click on Create app password and tick at least the and 写作 permissions of the 储存库 for the basic pull and push actions. Then give some label and submit by Create. enter image description here
  • 生成的应用程序密码应该在 IDE 中传递 enter image description here

我创建了一个应用程序密码,确保用户是用户名而不是电子邮件,在 Windows 的 Credential Manager中更新了应用程序密码,但在存储库路径中添加应用程序密码最终解决了我的问题:

来自:

Https://username@bitbucket.org/.

致:

Https://username:app_password@bitbucket.org/.

Try this 没有密码 login. With this, you will never need to worry about remembering the password again on your machine (don’t use this technique on public computers)

设置 SSH 密钥

git remote set-url origin https://<Bitbucket_Username>:<App_Password>@bitbucket.org/<Repo_Name>.git

这招对我很管用。

Go to 个人设置 from the menu at the top. Click on 应用程序密码 and set up the permissions as required as shown below.

复制生成的密码并在身份验证提示上使用它。这将解决问题。

Enter image description here

尝试创建 ssh 键并将 ssh 键添加到 bitbucket 中,然后尝试

如果您已经生成了一个应用程序密码,如果您正在使用 VSCode 并且已经安装了 Atlassian 扩展,那么单击 git pull/push 按钮,这将打开登录对话框。点击授权,就这样。现在您已登录。

enter image description here

我在使用 Android Studio 的 Mac 上遇到了一些问题。我通过进入 Android Studio 终端选项卡并编写代码修复了这个问题

git push

然后它告诉我那是致命的: 当前的 blabla _ Branch _ name 分支没有上游分支。要推动当前分支并将远程设置为上游,请使用

git push --set-upstream origin blabla_branch_name

所以我把它复制粘贴到终端上,然后再按回车键。这次它问我要密码。我登陆了我的 bitbucket 账户,创建了一个新的应用程序密码。然后我复制了它创建的密码,并将其粘贴到终端中,然后按回车键。这似乎已经重新连接设备和位桶和东西再次工作。

在我的例子中,我没有选择创建应用程序密码,而是选择创建令牌。现在,一旦创建了标记,就必须将相同的标记替换为密码。这可以在 Android Studio/IDEA 和命令提示符上运行。希望这对其他人有所帮助!

enter image description here