Permission denied (publickey).
fatal: Could not read from remote repository.
是公钥出问题了,要先设置用户和邮箱再重新生成ssh公钥即可。
1.首先我得重新在git设置一下身份的名字和邮箱 进入到需要提交的文件夹底下(因为直接打开git Bash,在没有路径的情况下,根本没!法!改!刚使用git时遇到的坑。。。)
git config --global user.name “yourname”
git config --global user.email “your@email.com”
注:yourname是你要设置的名字,your@email是你要设置的邮箱。
2.删除 .ssh 文件夹【C:\Users(本地用户名).ssh】 中的 known_hosts(直接删除即可)
3.在下载好的Git中的bin目录下(一般是 C:\Program Files\Git\bin)打开bash.exe输入命令
$ ssh-keygen -t rsa -C “your@email.com”(请填你设置的邮箱地址)
如果执行成功。返回:
Generating public/private rsa key pair.
Enter file in which to save the key (/c/Users/your_user_directory/.ssh/id_rsa):
如果以前有存储地址会返回/Users/your username/.ssh/id_rsa already exists.Overwrite (y/n)?直接输入y回车。
如果以前没有储存地址就会出现Enter passphrase(empty for no passphrase);也直接回车,
两种情况回车后都会出现 Enter same passphrase again 然后接着回车会显示
The key’s randomart image is:
±–[RSA 2048]----+
| .o== oo+.o.oo. |
|…+=++…O =… . |
|.o.+oo+.B o o o |
| o…o.o . o |
| o…S o |
| . . o… |
| . . o o |
|. . + |
|oE .o . |
±—[SHA256]-----+