git push -u origin master 报错

    技术2026-06-17  8

     

    ssh: Could not resolve hostname git#github.com: Name or service not known fatal: Could not read from remote repository.

    Please make sure you have the correct access rights and the repository exists.

    github 报错,

    根据查询解决步骤

    1、ping github.com  无法ping同

    通过IPaddress 查询 到 ip 地址后

    修改 C:\Windows\System32\drivers\etc\host.txt  无法保存用管理员打开

    140.82.113.4 github.com 199.232.69.194 github.global.ssl.fastly.net   在末尾添加 ip不一定一致 自行查询通过https://www.ip138.com/ 分别查询

    修改完整 刷新Dns flush/DNS 能够ping 但还是报错

    2、修改Key  通过 git bash 输入 不过先要删除原来

    C:\Users\Administrator\.ssh 有 

    删除后 git bash 运行

    ssh-keygen -t rsa -C "your_email@example.com"

    在输入cat ~/.ssh/id_rsa.pub

    复制后到github  修改 点击后添加新得key

    测试

    3 、ssh -T git@github.com

    https://stackoverflow.com/questions/26953071/github-authentication-failed-github-does-not-provide-shell-access

    You've successfully authenticated, but GitHub does not provide shell access.

    尝试重新定义ssh网址以获取远程来源:

    git remote set-url origin git@github.com:lut/EvolutionApp.git成功!
    Processed: 0.008, SQL: 13