Support for password authentication was removed
上面的提示好多人都遇到了吧
在2021年8月13日github停止了对https用户名及验证码的支持 这几天估计github官网都是拥堵的状态
修改方式我发给大家 直接上代码吧
首先 我的电脑是mac 应该win也差不多吧
1.跳进家的ssh 目录
cd ~/.ssh/
2.然后vim config (很多人都有github的 公司的 根本不能用相同公钥与私钥 肯定行不通)
Host hostname1
User username1
#Port 8930 (如果端口不是22 打开注释 改成您的端口)
IdentityFile ~/.ssh/id_rsa_host1
Host hostname2
User username2
#Port 8930
IdentityFile ~/.ssh/id_rsa_host2
3.生成id_rsa_pub 和id_rsa
ssh-keygen -t rsa -b 2048 -C "username"
ssh-keygen -t rsa -b 2048 -C "username"
Generating public/private rsa key pair.
Enter file in which to save the key (/Users/pengzongge/.ssh/id_rsa): id_rsa_hostnamex
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in id_rsa_hostnamex.
Your public key has been saved in id_rsa_hostnamex.pub.
The key fingerprint is:
SHA256:iX9Ziyz/TFYYxm6yhM3bDCAu7rwDIB4NuYW5KOFNR/A pzgmissyou@sina.com
The key's randomart image is:
+---[RSA 2048]----+
| +.o. |
|.= o.. . |
|o.O .E. . + |
|== o . o * o o |
|+.. . o S * = . |
| ... . . o % o |
| .. o B * |
| o. + + |
| +o ..o |
+----[SHA256]-----+
注:Enter passphrase 好像可以不填 我都填了
这样在你的目录下就能看到相应的id_rsa_hostnamex 和id_rsa_hostname.pub了 这样就算成功了
4.然后登录github 会提示加ssh_key
cat id_rsa_hostnamex.pub
把里面的内容全复制 然后粘贴就可以了
5.然后跳进你原来的git目录
vim .git/config
修改url 就可以了
[core]
repositoryformatversion = 0
filemode = true
bare = false
logallrefupdates = true
ignorecase = true
precomposeunicode = true
[remote "origin"]
url = newUrl
fetch = +refs/heads/*:refs/remotes/origin/*
[branch "master"]
remote = origin
merge = refs/heads/master