GitHub与Git入门时期报错的解决方式

350 阅读1分钟

报错1: $ ssh -T git@github.com The authenticity of host 'github.com (xxxxxx)' can't be established. ED25519 key fingerprint is xxxxxxxxxxxxxxxxxxxxxxx This key is not known by any other names Are you sure you want to continue connecting (yes/no/[fingerprint])?

解决1:输入yes再按回车继续

报错2: $ git pull origin master fatal: couldn't find remote ref master

解决2: 将输入更改为git pull origin main回车即可

报错3: $ git commit -m "add test" Author identity unknown

*** Please tell me who you are.

Run

git config --global user.email "you@example.com" git config --global user.name "Your Name"

to set your account's default identity. Omit --global to set the identity only in this repository.

fatal: unable to auto-detect email address (got 'xxxxL.(none)')

解决3:按照提示输入Run下的内容即可

报错4: $ git push origin main error: src refspec main does not match any

解决4: 输入git branch -m master main将本地Git的master名字改为main名字,再运行git push origin main

报错5: $ git push origin main fatal: unable to access 'github.comxxxx.git/': Failed to connect to github.com port xxx after 21096 ms: Timed out

解决5: 挂国外VPN,换microsoftedge浏览器试试

报错6: $ git push origin main warning: ----------------- SECURITY WARNING ---------------- warning: | TLS certificate verification has been disabled! | warning: --------------------------------------------------- warning: HTTPS connections may not be secure. See aka.ms/gcm/tlsveri… for more information. fatal: 发送请求时出错。 fatal: 无法连接到远程服务器 fatal: 由于连接方在一段时间后没有正确答复或连接的主机没有反应,连接尝试失败。 xxxx remote: Support for password authentication was removed on August 13, 2021. Please use a personal access token instead. remote: Please see github.blog/2020-12-15-… for more information. fatal: Authentication failed for 'github.com/xxxxxxx.git…'

解决6: 按照提示,设置Git Hub的personal access token,设置方式自行百度。获得token后再运行git push origin main,将token粘贴到弹出框中即可,再次尝试git push origin main即可。