问题描述
Username for 'https://github.com': LAL-Better
Password for 'https://LAL-Better@github.com':
remote: Support for password authentication was removed on August 13, 2021.
remote: Please see https://docs.github.com/get-started/getting-started-with-git/about-remote-repositories#cloning-with-https-urls for information on currently recommended modes of authentication.
fatal: Authentication failed for 'https://github.com/LAL-Better/funny-project.git/'
解决办法
1. 安装git权限管理工具gcm
本机使Ubuntu,其它操作系统可以参考: gcm 安装指南
Ubuntu 操作步骤
- 在gcm下载下载对应版本
- 安装gcm
sudo dpkg -i gcm-linux_amd64.2.4.1.deb
- 运行配置命令
git-credential-manager configure
- 使用gpg保管密钥
git config --global credential.credentialStore gpg
- 如果没有gpg key则生成一个
gpg --generate-key
结果中包含以下信息
pub rsa3072 2024-03-29 [SC] [expires: 2026-03-29]
22C64B88AC6606C857C34749E8C64B191B3815ED
uid deg1wx <mingliang.deng@cn.bosch.com>
sub rsa3072 2024-03-29 [E] [expires: 2026-03-29]
- 最后,记住pub 后的一串字符(公钥)然后执行以下命令
pass init 22C64B88AC6606C857C34749E8C64B191B3815ED
如果没有pass命令,则使用sudo apt install pass
安装。