git push失败,报错fatal: does not appear to a git repository Could not read from remote repository

2018年10月25日 16:33:58 python_neophyte 阅读数 1553

版权声明:转载请附上链接 https://blog.csdn.net/python_neophyte/article/details/83381936

几周没用git,今天一来托管就报错,下面记录一下解决办法。

$ git push -u origin master
fatal: 'git@github.com/zejun_web' does not appear to be a git repository
fatal: Could not read from remote repository.Please make sure you have the correct access rights
and the repository exists.

这是报错信息,建立了文件夹用了

git init

后,也remote了,结果就是push不上去。

后面检查了一下remote内容

$ git remote -v
origin  git@github.com/zejun_web (fetch)
origin  git@github.com/zejun_web (push)

敢情是remote命令就错了,里面少了git账号:git-ze,应该是:

git remote add origin git@github.com:git-ze/zejun_web.git

这样就知道怎么解决了,
先remove掉添加在远程的origin

git remote rm origin

此时再用

git remote -v

就会发现没有origin了

再正确输入

git remote add origin git@github.com:git-ze/xxxx.git

就可以了。

然后

$ git push -u origin master
Enumerating objects: 7, done.
Counting objects: 100% (7/7), done.
Delta compression using up to 8 threads
Compressing objects: 100% (3/3), done.
Writing objects: 100% (7/7), 545 bytes | 272.00 KiB/s, done.
Total 7 (delta 1), reused 0 (delta 0)
remote: Resolving deltas: 100% (1/1), done.
remote:
remote: Create a pull request for 'master' on GitHub by visiting:
remote:      https://github.com/git-ze/zejun_web/pull/new/master
remote:
To github.com:git-ze/zejun_web.git* [new branch]      master -> master
Branch 'master' set up to track remote branch 'master' from 'origin'.

到这里就成功啦。
网上查了一下还有的说要重新配置邮箱和姓名等信息的。。如果没有添加公钥的话确实
还是要先在GitHub上添加公钥,
如果已经添加过了,可以先用git remote -v命令来检查一下添加的origin是不是代码写错了,写少了。
如果错了就先 git remote rm origin
然后最后就可以push了。

要注意的就是第一次push的话,要加上 -u 在语句里,把本地master分支和远程库的master分支关联起来。

fatal: does not appear to a git repository相关推荐

  1. git push失败,报错fatal: does not appear to a git repository Could not read from remote repository

    我们在使用git的时候,git push会报错, $ git push -u origin master fatal: 'git@github.com/zejun_web' does not appe ...

  2. Git错误:fatal: Not a git repository (or any of the parent directories)解决方法

    我用git add file添加文件时出现了这样错误: fatal: Not a git repository (or any of the parent directories): .git 提示说 ...

  3. Git的fatal: Not a git repository (or any parent up to mount point /home)

    fatal: Not a git repository (or any parent up to mount point /home) Stopping at filesystem boundary ...

  4. 执行git命令时出现fatal: ‘origin‘ does not appear to be a git repository错误

    执行git命令时出现fatal: 'origin' does not appear to be a git repository错误 在执行git pull origin master时出现: fat ...

  5. 将本地已经存在的代码跟github上新建的仓库建立关联,解决“fatal: 'origin' does not appear to be a git repository...”

    我想将本地已经存在的代码跟github上新建的仓库建立关联,步骤如下: 进入本地目录,初始化本地仓库 1.进入本地目录,初始化本地仓库:git init 2.将文件添加到仓库:git add . 3. ...

  6. fatal: ‘origin‘ does not appear to be a git repository fatal: Could not read from remote repository.

    fatal: 'origin' does not appear to be a git repository fatal: Could not read from remote repository. ...

  7. 解决:fatal: not a git repository (or any of the parent directories): .git的问题

    解决:fatal: not a git repository (or any of the parent directories): .git的问题 提示说没有.git这样一个目录 解决办法: 在命令 ...

  8. git 解决fatal: Not a git repository

    我用git add file添加文件时出现这样错误: fatal: Not a git repository (or any of the parent directories): .git 提示说没 ...

  9. Git 小问题:fatal: not a git repository (or any of the parent directories): .git

    超详细 Git 图文版小白教程(持续更新) 在clone仓库到本地后,执行命令提示:fatal: not a git repository (or any of the parent director ...

最新文章

  1. 测试一下StringBuffer和StringBuilder及字面常量拼接三种字符串的效率
  2. 判断题:oracle自带的sql语言环境是pl/sql,Oracle之PL/SQL学习笔记之数据类型(三)
  3. 隐藏层节点数对迭代次数分布规律的影响
  4. Windows Batch [精华]
  5. java 百度账号注册界面_基于百度AI开放平台的人脸识别的注册登录(1)
  6. 如果可能我们还是做好基础的事情吧
  7. 实验一 软件工程准备
  8. 1259:【例9.3】求最长不下降序列
  9. python两个一维数组合并_python:16.合并两个排序的链表
  10. HDU 6356.Glad You Came-线段树(区间更新+剪枝) (2018 Multi-University Training Contest 5 1007)...
  11. 记录一些js面试题以及解法
  12. 内核提速开机linux,Linux启动全线提速法
  13. 前向声明include区别
  14. 利用定时器中断方式控制led灯的闪烁速度_实验四 LED点阵
  15. opencv实时录像+视频打码
  16. matlab代码:基于主从博弈的智能小区代理商定价策略及电动汽车充电管理
  17. 如何才能不改变图片的像素大小,只改变图片的文件大小
  18. 雨点效果——HTML5之特效
  19. JAVA毕业设计高校人事管理系统计算机源码+lw文档+系统+调试部署+数据库
  20. Fabric 1.0源代码分析(22)Ledger #blkstorage(block文件存储)

热门文章

  1. 燕山大学——软件用户界面设计(五)UI架构
  2. 日志分析之识别真假蜘蛛与处理办法
  3. jquery开发知识总结2
  4. Html编码(#数字型)与解码小结 - 针对Puny Code(中文域名)的解码处理
  5. ClickOnce踩坑记录
  6. 体育测试成绩用什么软件制表,如何用电子表格进行体育成绩的统计.docx
  7. 如何删除word空白页技巧汇总
  8. 循环(环形)缓冲区之Boost::circular_buffer
  9. 第三章 标准单元库(下)
  10. 85. 如何用 OPA5 编写测试用例来测试用户输入文本的功能