ssh配置好后无法拉取代码

  • 问题?
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    Cloning into 'your repositories'...
    kex_exchange_identification: read: Software caused connection abort
    banner exchange: Connection to 20.205.243.166 port 22: Software caused connection abort
    fatal: Could not read from remote repository.

    Please make sure you have the correct access rights
    and the repository exists.

    克隆到“您的存储库”...
    kex_exchange_identification:读取:软件导致连接中止
    横幅交换:连接到 20.205.243.166 端口 22:软件导致连接中止
    致命:无法从远程存储库中读取。

    请确保您拥有正确的访问权限
    并且存储库存在。
  • 解决方法:
    • vim ~/.ssh/config,添加如下配置
      1
      2
      3
      Host github.com
      Hostname ssh.github.com
      Port 443

配置sshconfig报错

给当前用户执行权限:chown $USER ~/.ssh/config

1
2
3
4
5
6
7
8
9
10
11
Bad owner or permissions on ~/.ssh/config
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.
[root@cxvh blogs]# git pull origin butterfly -f
Bad owner or permissions on ~/.ssh/config
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

win生成密钥ssh-keygen写入权限不够报错

进入文件夹后执行生成命令 C:\Users\用户\.ssh\gitlab

1
Saving key "\033[A\033[B/c/Users/Baran.Lee/.ssh/id_rsa)\033[D\033[D\033[C\033[\033[D\033[D\033[D\033[D\033[D\033[Dcodeba/id_rsa" failed: No such file or directory

历史中不连续的commit合并 git rebase -i head~3,然后报错如下:

回到rebase执行之前的状态 git rebase --abort

1
2
3
4
5
6
7
8
9
10
11
interactive rebase in progress; onto bbef1ea
No commands done.
Next commands to do (3 remaining commands):
s ae093ef 更新 circleci 配置文件
s 1ab23ac 更新 circleci 配置文件2
(use "git rebase --edit-todo" to view and edit)
You are currently editing a commit while rebasing branch 'main' on 'bbef1ea'.
(use "git commit --amend" to amend the current commit)
(use "git rebase --continue" once you are satisfied with your changes)

nothing to commit, working tree clean

git push orgin main

干掉.git目录,重新配置 git init…

1
2
3
4
5
6
7
8
9
10
11
12
fatal: 'orgin' does not appear to be a git repository
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.
#
$ git push orgin主要
致命的:“ orgin”似乎不是git存储库
致命:无法从远程存储库读取。

请确保您具有正确的访问权限
并且存储库存在。

无法切换分支?切换为其它分支后再切换回来报错如下

解决方法:

  1. 重新克隆法(用了非常不错)
    当前项目(项目名:foo)重命名备份为(新名称:foo_cp),主要是备份.git
    然后克隆项目,名称为(项目名:foo),然后把foo_cp下面的.git文件夹拷贝到foo下面
    git checkout -f dev即可切换分支
  2. fetch法(还没用过)
1
2
3
4
5
6
7
8
cp -R foo foo-backup 	# 先备份
cp -R foo foo-backup # 一定要先备份
rm -fr .git
git init
git remote add origin [your-git-remote-url]
git fetch
git reset --mixed origin/master # 国内文档大多把这里改成了--hard,未提交彻底丢失
git branch --set-upstream-to=origin/master master

来源

1
2
3
4
5
error: inflate: data stream error (incorrect header check)
error: unable to unpack 7107914b201232028fcc047cc84824c583a2a9d6 header
error: inflate: data stream error (incorrect header check)
error: unable to unpack 7107914b201232028fcc047cc84824c583a2a9d6 header
fatal: loose object 7107914b201232028fcc047cc84824c583a2a9d6 (stored in .git/objects/71/07914b201232028fcc047cc84824c583a2a9d6) is corrupt

无法提交到这个分支?解决这个文件.github/workflows/tests.yml即可提交

1
2
 ! [remote rejected] master -> master (refusing to allow a Personal Access Token to create or update workflow `.github/workflows/tests.yml` without `workflow` scope)
error: failed to push some refs to 'https://github.com/code-ba/brew-install.git'

“fatal: unknown index entry format 0x19f80000”

1
2
rm -f .git/index
git reset