Git 提示 fatal: bad config line 1 in file .git/config
admin 阅读:69 2024-03-02
git push 提示错误:
fatal: bad config line 1 in file .git/config
我的解决办法是直接删除项目目录下的 .git/config 文件,然后重新 git init。
再次 git push 又遇到报错:
git@github.com: Permission denied (publickey).
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
这个错误原因是没有 ssh key,运行下面代码生成 ssh key:
$ ssh-keygen -t ed25519 -C "你的github邮箱"
路径默认即可,passphrase空即可,然后会在提示的目录下生成 id_ed25519.pub 文件,用记事本打开,复制里面的一串代码。然后点击 github 头像 -> Settings -> SSH and GPG keys -> New SSH key ,Title 随意,Key 中粘贴刚才复制的代码,然后输入账号登录密码确认。
之后再次 gut push 正常提交。
声明
1、部分文章来源于网络,仅作为参考。 2、如果网站中图片和文字侵犯了您的版权,请联系1943759704@qq.com处理!