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

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

git status

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

设置远端仓库地址 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

git 回滚提交

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

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

gitignore notworking:

git rm -r --cached .
git add .
git commit -m "fixed untracked files"

git Failed to connect to www.google.com port 80: Timed out 可能是因为设置了代理:

git config --global http.proxy          //查看代理
git config --global --unset http.proxy //取消代理

HTTP Basic access denied on Git:

git config --global --unset credential.helper
git clone '···'
login username,password

rebase 和 merge 区别

git pull --rebase origin master

rebase 选项告诉 Git 把你的提交移到同步了中央仓库修改后的 master 分支的顶部。rebase 操作过程是把本地提交一次一个地迁移到更新了的中央仓库master分支之上。这意味着可能要解决在迁移某个提交时出现的合并冲突,而不是解决包含了所有提交的大型合并时所出现的冲突。这样的方式让你尽可能保持每个提交的聚焦和项目历史的整洁。反过来,简化了哪里引入Bug的分析,如果有必要,回滚修改也可以做到对项目影响最小。

git pull origin master

如果没有 rebase, pull 操作仍然可以完成,但每次 pull 操作要同步中央仓库中别人修改时,提交历史会以一个多余的『合并提交』结尾。 
合并玩冲突之后,git rebase --continue,Git 会继续一个一个地合并后面的提交,如其它的提交有冲突就重复这个过程。 
如果你碰到了冲突,但发现搞不定,不要惊慌。只要执行下面这条命令,就可以回到你执行git pull –rebase命令前的样子:git rebase --abort

Git安装遇到的问题fatal: Could not read from remote repository.的解决办法的更多相关文章

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

    1. git remote –v查看远端地址或者查看配置 git config –list 2. git status 3. git add . git status git commit -m “本 ...

  2. git clone ssh 时出现 fatal: Could not read from remote repository

    一.问题及解决办法参考: 在 ubuntu 中,要把 GitHub 上的储存库克隆到计算机上时,执行如下命令: git clone git@github.com:USER-NAME/REPOSITOR ...

  3. gitlab 安装遇到 fatal:does not appear to be a git repository fatal: Could not read from remote repository. 问题

    Cloning into 'door_lock_bsp'... git@192.168.1.5's password:  fatal: 'door_lock/door_lock_bsp.git' do ...

  4. git pull 出错 fatal: Could not read from remote repository.Please make sure you have the correct access rights.and the repository exists.

    Warning: Permanently added the RSA host key for IP address '192.30.252.131' to the list of known hos ...

  5. git提示错误关于错误:ssh: Could not resolve hostname github.com: Name or service not known.fatal: Could not read from remote repository.

    关于 Git 使用中出现的错误 饥人谷_楠柒 关注 2016.11.02 15:33* 字数 746 阅读 3607评论 5喜欢 10赞赏 1 关于错误:ssh: Could not resolve ...

  6. 用ssh进行git clone出现 fatal: Could not read from remote repository.

    问题:在通过MobaXterm进行ssh连接的服务器上用ssh进行git clone出现 fatal: Could not read from remote repository. 解决方法:prox ...

  7. git之fatal: Could not read from remote repository

    问题背景:在git bash中使用hexo g -d命令进行文章发布 详细错误信息: fatal: Could not read from remote repository. Please make ...

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

    天gitlab中遇到的问题: 当 git push origin branch_name时遇到报错如下: fatal:'origin' does not appear to be a git repo ...

  9. 【git基础】Permission denied (publickey). fatal: Could not read from remote repository

    运行以下git命令的时候出现错误 git push -u origin master error The authenticity of host 'github.com (13.250.177.22 ...

随机推荐

  1. Java设计模式之工厂模式的两种实现方式

    工厂模式(Factory Pattern)是 Java 中最常用的设计模式之一.这种类型的设计模式属于创建型模式,它提供了一种创建对象的最佳方式. 1. 为什么要有工厂模式? "Talk i ...

  2. [svc][jk]磁盘的iops和吞吐量(Throught)指标

    参考 另参考 IOPS (Input/Output Per Second)即每秒的输入输出量(或读写次数),是衡量磁盘性能的主要指标之一.IOPS是指单位时间内系统能处理的I/O请求数量,一般以每秒处 ...

  3. Redis数据类型应用场景及具体方法总结

    StringsStrings 数据结构是简单的key-value类型,value其实不仅是String,也可以是数字.使用Strings类型,你可以完全实现目前 Memcached 的功能,并且效率更 ...

  4. flink Job提交过程

    https://www.jianshu.com/p/0cdfa2a05ebd http://vinoyang.com/2017/04/02/flink-runtime-client-submit-jo ...

  5. Lua官方文档与源码分析

    https://www.lua.org/source/5.3/ http://www.cppblog.com/airtrack/archive/2012/09/19/191233.html https ...

  6. Splunk Web页面的登录密码忘记了怎么办

    splunk的web登录密码忘记的话,可以使用以下方法重置. 一.关闭splunk服务 /opt/splunk/bin/splunk stop 二.删除默认密码配置文件 三.重启启动splunk服务, ...

  7. django中celery的使用

    1.什么是celery celery是一个异步任务框架,当我们的程序中存在一个比较耗时的操作时,可以启动这个异步任务框架, 将耗时操作,交给它来完成,这样节省了程序的执行时间. 2.celery的原理 ...

  8. LearnOpenGL 你好,三角形[转]--附源码

    原地址:你好,三角形 你好,三角形 原文 Hello Triangle 作者 JoeyDeVries 翻译 Django 校对 Geequlim 译注 在学习此节之前,建议将这三个单词先记下来: 顶点 ...

  9. Windows下GUI编程——窗口

    windows下创建一个基于GUI的窗口程序很简单,使用MFC或者Win32 API都可以实现.本文简单整理下windows API创建GUI应用程序的基本编码框架. 比较常见的窗口包括:桌面窗口.应 ...

  10. OSX系统添加定时任务 Linux crontab命令 定时执行py 文件 任务

    #输出日志 #将日志输入到2.log文件中无论错误还是正确02 15 * * * . ~/xad/pyenv/xadserver/bin/activate && cd /root/xa ...