今天在Push 代码到Git 上时,无法推送代码到远程仓库,查看输出结果
正在推送 master
Pushing to git@address.git
Connection reset by 18.140.96.234 port 22
发布到远程存储库时遇到错误: Git failed with a fatal error.
Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
这个项目是前几天clone下来的,并且之前都是可以 pull 和 push 的。
后来检查发现是本地的用户配置信息出了问题
- 通过 git config --global --list 命令查看用户配置信息
这里需要注意的是user.name 和 user.email,user.name 需与clone 项目的帐号的用户名一致
user.email是否是自己github的登录邮箱
注意这两个都是自己的github账号的用户名和邮箱!!!!!
我是user.name这个配置错了
重新配置
git config --global user.name "自己github用户名"
git config --global user.email "自己github登录邮箱"
删除.ssh/known_hosts文件
这个.ssh文件夹在 c:/用户/用户名文件夹/下,将.ssh/known_hosts文件删除
重新进行git pull/push
成功了
因为是自己个人的项目,通过以上操作确实可以正常pull 和 push了!
谨在此记录一下!