转自: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. 深入理解Linux内核-中断和异常

    Linux内核代码查看 http://androidxref.com/ 中断:被定义位一个事件,它能改变处理器执行指令的顺序.它对应硬件(CPU.其他硬件设备)电路产生的电信号. 同步中断:指令执行时 ...

  2. 银联在线支付B2C UnionPay.NET

    新春即将来临,首先给大家拜个早年,祝攻城狮们新年快乐.万事如意.合家欢乐.团团圆圆.幸福健康.来年更能大展宏图 实现各自的梦想! 同时预祝各大科技公司大佬们事业蒸蒸日上.公司转型突破创新.冲出突围带领 ...

  3. Linux下双网卡绑定bond0【转】

    一:原理: linux操作系统下双网卡绑定有七种模式.现在一般的企业都会使用双网卡接入,这样既能添加网络带宽,同时又能做相应的冗余,可以说是好处多多.而一般企业都会使用linux操作系统下自带的网卡绑 ...

  4. java多线程18: ThreadLocal的作用

    从上一篇对于ThreadLocal的分析来看,可以得出结论:ThreadLocal不是用来解决共享对象的多线程访问问题的,通过ThreadLocal的set()方法设置到线程的ThreadLocal. ...

  5. Docker Dockerfile 基本结构详解

    dockerfike快速创建自定义的Docker镜像 一.目录 1.docker典型结构 2.指令介绍 3.创建docker镜像 二.结构 DockerFile分为四部分组成:基础镜像信.维护者信息. ...

  6. tensorboard简单使用

    代码写的再好,没有图别人也不知道好在哪. 我们在使用tensorflow的时候,使用tensorboard可以直观的看到我们的网络结构,甚至它可以计算卷积和池化的维度(我不知道是不是因为我已经运行了一 ...

  7. iOS开发:代码通用性以及其规范 第一篇(附带,自定义UITextView\进度条\双表显示\瀑布流 代码设计思路)

    在iOS团队开发中,我见过一些人的代码,也修改过他们的代码.有的人的代码写的非常之规范.通用,几乎不用交流,就可以知道如何修改以及在它基础上扩展延生.有的人的代码写的很垃圾,一眼看过去,简直会怀疑自己 ...

  8. 基于Keepalived实现LVS双主高可用集群

    Reference:  https://mp.weixin.qq.com/s?src=3&timestamp=1512896424&ver=1&signature=L1C7us ...

  9. C#学习笔记(9)——委托(窗体传值)

    说明(2017-5-30 11:38:06): 1. 窗体1传值到窗体2,只要实例化Form2,“Form2 frm2 = new Form2(txt1.Text)”,这里要给Form2加一个带参数的 ...

  10. C#学习笔记(6)——大项目增删改查

    说明(2017-5-28 11:35:39): 1. 需要注意的地方很多 2. 首先是连接字符串str要直接写在类里面,不然每个按钮里面都要写一遍. 3. 查询用到sqlDataReader等三个方法 ...