我正在使用BitBucket、Xcode和Git进行版本控制,最近我更改了所有密码(感谢Adobe!)。
毫不意外的是,我无法将本地提交推送到BitBucket存储库(身份验证失败,'https://______.git'
),但我忘记了如何在我的iMac上更新缓存密码。虽然我认为这应该非常简单,但我在Google或Stack Overflow上找不到它...
我正在使用BitBucket、Xcode和Git进行版本控制,最近我更改了所有密码(感谢Adobe!)。
毫不意外的是,我无法将本地提交推送到BitBucket存储库(身份验证失败,'https://______.git'
),但我忘记了如何在我的iMac上更新缓存密码。虽然我认为这应该非常简单,但我在Google或Stack Overflow上找不到它...
git config --global --unset user.password
添加了新密码:
git config --global --add user.password "new_password"
而且对我来说它起作用了。
git credential reject
命令:$ git credential reject
protocol=https
host=bitbucket.org
⏎
或者$ git credential reject
url=https://bitbucket.org
⏎
接下来,要输入您的新密码,请键入git fetch
。
鉴于自2021年8月13日起实施的新的令牌认证要求,这可能是您正在寻找的内容:
git remote remove origin
git remote add origin https://[TOKEN]@github.com/[USER]/[REPOSITORY]
git push
git remote -v
这样就可以看到现有的[USER]和[REPO]参数。 - Neil Fraser|-- Run this command. You will be prompted on next push/pull to enter username and password:
| git config --global credential.helper wincred (Thanks to @Andrew Pye)
`MacOS:
|
|-- 1. Using git config to store username and password:
| git config --global --add user.password
|
|---- 1.1 first time entry
| git config --global --add user.password <new_pass>
|
|---- 1.2 password update
| git config --global --unset user.password
| git config --global --add user.password <new_pass>
|
|-- 2. Using keychain:
| git config --global credential.helper osxkeychain
|
|---- 2.1 first time entry
| Terminal will ask you for the username and password. Just enter it, it will be
| stored in keychain from then on.
|
|---- 2.2 password update
| Open keychain, delete the entry for the repository you are trying to use.
| (git remote -v will show you)
| On next use of git push or something that needs permissions, git will ask for
| the credentials, as it can not find them in the keychain anymore.
`
git config --global --unset user.password
,然后运行git push origin master
将会要求你输入用户名和密码。也把这个加入到答案中? - Bazer Con这是我第一次推送到该代码库,因此没有定义HEAD
。
最简单的方法是:
git push -u origin master
然后它会提示输入密码,一旦您输入密码,它将自动保存,然后您就可以推送了。
请在终端中执行以下步骤:
删除您的 Mac 中保存的当前密码
git config --global --unset user.password
通过以下命令添加您的新密码,将“”替换为您的新密码:
git config --global --add user.password <new_pass>
你可以在2个地方通过命令行更改密码,下面的内容将编辑凭据以连接存储库
git config --edit
凭据也可以使用全局参数进行更改,例如下面的示例。 git config --global --add user.password "XXXX"
或者使用凭据助手设置
git config --global credential.helper wincred
但是如果您设置了存储库级别的凭据,则使用第一个命令。
git config --edit
在 Github 桌面版偏好设置中我的密码是正确的,但在 .git/config
文件中却是错误的。
对我来说,唯一的有效解决方案是手动编辑此文件:.git/config
该文件包含以下行:
url = https://user:password@github.com/user/repo.git
我想把密码改成一个更加安全的密码,因为原来的密码已经有些年头了。