转自: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. centos 7 忘记密码

    修改rd.lvm.lv=cl/swap(我的是虚似机如果是实体机的话应该是ro_rd.lvm.lv=centos/swap)改成 rw init=/sysroot/bin/sh 注意上图rw init ...

  2. centos 7 五笔安装

    # yum install ibus ibus-table-wubi 需要重启动

  3. nodejs文件上传报错总结

    语法: fs.rename(oldPath,newPath,callback) 今天在使用formidable模块做图片上传处理的时候,fs.rename方法的报了一个这样的错:cross-devic ...

  4. vscode 换行符\n 变成\r\n

    VSCode是一个开源的强大代码编写器,但是如果没有好好的配置使用,会适得其反. 这里总结VSCode的一些配置,方便自己查询,也方便网友. 1.编辑器配置 为特定类型文件指定缩进大小.缩进类型(空格 ...

  5. 每日英语:China's Bigger Innovation Problem

    Last month's Third Plenum meeting of Chinese leaders seemed to signal Beijing's intention to experim ...

  6. android alipay

    "java.security.spec.InvalidKeySpecException" KeyFactory keyFactory =KeyFactory.getInstance ...

  7. 【转】更改 shell 终端的默认键绑定为 vi 模式

    我们使用的 shell 终端是 bash,它的默认键绑定方式是 emacs 模式.比如键入 Ctrl+a 光标会停在行首,Ctrl+e 光标会停在行尾等等. 如果希望在终端输入时使用 vi 的模式,比 ...

  8. ThinkPad X220 完美黑苹果 Hackintosh OS X 10.11 El Capitan

    原文链接:https://www.gaojinan.com/thinkpad-x220-hackintosh-osx-10-11-el-capitan-perfect.html //Update 20 ...

  9. opencv项目报错_pFirstBlock==pHead解决办法

    备注: 我上次遇到这个问题的原因是项目设置为MTd导致的 OpenCV是MTd的,我要是改成MDd就编译报错,所以不能采用把项目改为MDd的办法,只能把OpenCV重新编译为MDd的,下载CMAKE, ...

  10. kill-9导致weblogic无法启动

    转载自:http://blog.csdn.net/lykangjia/article/details/17486127?rsv_upd=1 今天单位系统遇到一个问题: Resolve Weblogic ...