fatal: Could not read from remote repository.的解决办法

fatal: Could not read from remote repository.的解决办法

原创 2016年08月26日 18:13:20



  • 查看远端地址 git remote –v
    查看配置 git config --list

    这里写图片描述

    git status

    这里写图片描述

     git add .  // 暂存所有的更改
     git checkout . // 丢弃所有的更改
     git status // 查看文件状态
     git commit -m "本次要提交的概要信息" // 提交
        
        
    • 1
    • 2
    • 3
    • 4

    这里写图片描述

    设置远端仓库地址 git remote set-url origin 你的远端地址
    git push origin master出现以下情况:

    这里写图片描述

    解决办法:删除当前key,然后重新生成key,

    这里写图片描述

    会在本地C:\Users\你的用户名.ssh生成文件夹,里面有id_rsa和id_rsa.pub两个文件
    然后复制id_rsa.pub文件里面的内容,到https://github.com/settings/keys新建一个,
    这里写图片描述
    设置远程地址:(上面新建的)
    git remote add origin_new 新的地址
    git remote –v查看
    git push origin_new master重新推送
    下面是设置用户名
    Git config –global user.name “用户名”
    git config –global user.email 邮箱地址

    设置代理:
    git config –global https.proxy http://127.0.0.1:1080
    取消设置代理:
    git config –global –unset https.proxy

    取消git init操作时出现 rm: cannot remove ‘.git’: Is a directory
    是因为输入的命令是: rm -f .git
    解决办法:rm -rf .git 即删除整个.git目录

    failed to push some refs to ‘git@github.com:*.git’ hint: Updates were rejected ···
    使用git push origin master的时候出现一下错误:

    这里写图片描述

    解决办法:
    git push -f origin master或者git pull下

    这里写图片描述

    恢复不小心删除的 git stash 文件:

    git fsck  //找到dangling的对象
    git show id  //上面列出的每一条记录的最后一个字符串,按 enter 查看具体信息
    git stash apply id
        
        
    • 1
    • 2
    • 3

    git 回滚提交

    //reset将一个分支的末端指向另一个提交。这可以用来移除当前分支的一些提交, 让master分支向后回退了两个提交
    git checkout master
    git reset HEAD~2
    
    //Revert撤销一个提交的同时会创建一个新的提交, 找出倒数第二个提交,然后创建一个新的提交来撤销这些更改,然后把这个提交加入项目中。
    git revert HEAD~2 
        
        
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6

    错误:Please enter a commit message to explain why this merge is necessary. 解决办法:
    1. (可选)按键盘字母 i 进入insert模式
    2. (可选)修改最上面那行黄色合并信息
    3. 按键盘左上角”Esc” (退出insert模式)
    4. 输入”:wq”,按回车键即可(提交)



    转载自:http://blog.csdn.net/huahua78/article/details/52330792

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值