转自: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. android studio - Manifest merger failed with multiple errors, see logs

    今天编译运行的时候遇到了“Error:Execution failed for task ':test:processDebugManifest'.> Manifest merger faile ...

  2. Ubuntu14.04 64bit 编译安装nginx1.7+php5.4+mysql5.6

    我的操作系统是Ubuntu14.04,其它linux系统的操作流程类似. 主要安装的软件是nginx1.7+php5.4+mysql5.6 1. 创建必要目录 sudo mkdir ~/setup s ...

  3. 【Tensorflow】设置显存自适应,显存比例

    用惯了theano.再用tensoflow发现一运行显存就满载了,吓得我吃了一个苹果. 用天朝搜索引擎毛都搜不到,于是FQ找了下问题的解决方法,原来有两种 按比例 config = tf.Config ...

  4. hdu3191+hdu1688(求最短路和次短路条数,模板)

    hdu3191题意:求出次短路的长度和条数 #include<iostream> #include<cstdio> #include<cstring> #inclu ...

  5. 秒杀怎么样才可以防止超卖?基于mysql的事务和锁实现

    Reference:  http://blog.ruaby.com/?p=256 并发事务处理带来的问题? 相对于串行处理来说,并发事务处理能大大增加数据库资源的利用率,提高数据库系统的事务吞吐量,从 ...

  6. Eigen教程(6)

    整理下Eigen库的教程,参考:http://eigen.tuxfamily.org/dox/index.html 高级初始化方法 本篇介绍几种高级的矩阵初始化方法,重点介绍逗号初始化和特殊矩阵(单位 ...

  7. iOS 导航栏返回到指定页面的方法和理解

    关于ios中 viewcontroller的跳转问题,其中有一种方式是采用navigationController pushViewController 的方法,比如我从主页面跳转到了一级页面,又从一 ...

  8. resource.h

    resource.h就是.rc文件的头文件.rc文件里的常量全在resource.h定义 .rc文件和resource.h 都是给project add resource 的时候VS 自动生成的.一般 ...

  9. 基于jQuery实现的腾讯互动娱乐网站特效

    分享一款基于jQuery实现的腾讯互动娱乐网站特效.腾讯互动娱乐网站jQuery特效是一款右侧带伸缩选项卡,支持鼠标滚轮滚动切换特效代码.效果图如下: 在线预览   源码下载 实现的代码. html代 ...

  10. 慢速HTTP拒接服务攻击(DoS)复现

    kali linux下有个神奇的工具叫“slowhttptest” 命令:slowhttptest -c 1000 -H -g -o slowhttp -i 10 -r 200 -t GET -u h ...