Git问题集合

# Git 问题集合

Git使用过程中各种问题搜集总结

# Github

  • 问题1
The authenticity of host '[ssh.github.com]:443 ([20.205.243.160]:443)' can't be established.
ED25519 key fingerprint is SHA256:+DiY3wvvV6TuJJhbpZisF/zLDA0zPMSvHdkr4UvCOqU.
This key is not known by any other names.
Are you sure you want to continue connecting (yes/no/[fingerprint])? y
Please type 'yes', 'no' or the fingerprint: y
这段话是什么意思 
1
2
3
4
5
6
这段话是 SSH 在首次连接一个服务器时,提示你确认该服务器的身份。具体含义如下:

The authenticity of host '[ssh.github.com]:443 ([20.205.243.160]:443)' can't be established.
这是告诉你,SSH 无法验证你正在连接的 GitHub 服务器的身份,因为这是你第一次连接到这个地址(ssh.github.com:443),所以它无法确认它是否可信。

ED25519 key fingerprint is SHA256:+DiY3wvvV6TuJJhbpZisF/zLDA0zPMSvHdkr4UvCOqU.
这里提供了服务器的公钥指纹(key fingerprint)。公钥指纹是该服务器的唯一标识,目的是帮助你确认该服务器是正确的。如果你有服务器的公钥指纹(可以通过 GitHub 官网查找),你可以比较它来确保安全。

This key is not known by any other names.
这说明 SSH 客户端没有找到该服务器的任何已知的标识名。

Are you sure you want to continue connecting (yes/no/[fingerprint])?
这是一个确认提示,询问你是否确定继续连接。如果你信任该服务器,输入 yes 来继续连接。

Please type 'yes', 'no' or the fingerprint: y
这时你需要输入 yes(确认连接)或 no(拒绝连接),或者输入公钥指纹以进一步验证。

解答
当你看到这个提示时,SSH 正在要求你确认该 GitHub 服务器的身份。如果你信任 GitHub 的服务器,可以输入 yes,继续连接。如果你不确定或没有验证过,可以选择 no,以中止连接。

通常来说,GitHub 的 SSH 公钥是安全的,输入 yes 来继续连接应该是没问题的。
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
  • 问题2
git.exe clone --progress -v "git@github.com:yangliangxii/ai789.site.git" "D:\ai789.site" Cloning into 'D:\ai789.site'... 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.
1

The specific error kex_exchange_identification: read: Software caused connection abort indicates a problem with the SSH handshake, and typically it means that the connection is being closed abruptly. This can happen due to several reasons. Let's troubleshoot this step-by-step:

1. Check Your Network Configuration:
Firewall/Antivirus: Ensure that there isn’t a firewall or antivirus software blocking the connection to GitHub’s SSH server. Temporarily disable your firewall or antivirus software and try again.
Proxy: If you're behind a corporate proxy, it might be interfering with the SSH connection. If you’re using a proxy, you can try to configure Git to bypass it using:

git config --global http.proxy ""
git config --global https.proxy ""
2. SSH Port Blocked:
Port 22 Blocked: If port 22 (the default SSH port) is blocked by your ISP or network, try switching to a different port. GitHub supports SSH over port 443 (which is usually open) by using an alternative URL:

git clone ssh://git@ssh.github.com:443/yangliangxii/ai789.site.git
This forces Git to use port 443 for SSH, which is commonly open for HTTPS traffic.

3. Test SSH Connection:
To verify that your SSH connection is working properly, run this command:

ssh -T git@github.com
If everything is set up correctly, you should see a message like:

Hi <username>! You've successfully authenticated, but GitHub does not provide shell access.
If it doesn't work, check your SSH key configuration or key permissions.

4. Check GitHub Status:
Sometimes GitHub itself might be having issues. Check GitHub’s status page to see if there are any ongoing network or service issues.

5. Switch to HTTPS (as a last resort):
If SSH continues to cause problems, you can always clone the repository using HTTPS instead of SSH:

git clone https://github.com/yangliangxii/ai789.site.git
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
  • 问题3

add 并commit后,当遇上到大文件无法上传时,需要强制删除历史记录并清理库,具体办法如下。在库的根目录下执行:

注意备份文件,不然会被命令彻底咔嚓掉。。。。。。。

git filter-branch --force --index-filter 'git rm --cached --ignore-unmatch 追光学院/内部培训/数字孪生到底有多强大?它离我们的生活还有多远.mp4' --prune-empty --tag-name-filter cat -- --all

git reflog expire --expire=now --all
git gc --prune=now --aggressive

git push origin --force --all
git push origin --force --tags
1
2
3
4
5
6
7
  • 问题4

push 大文件失败解决办法。

1 下载安装 https://git-lfs.com/
2 仓库根目录下:git lfs install
3 跟踪大文件:git lfs track "*.psd" "*.zip"
4 提交并推送更改:
  git add .gitattributes
  git add your_large_file.psd
  git commit -m "Add large file with LFS"
  git push origin main
1
2
3
4
5
6
7
8
上次更新: 2025/02/10, 20:20:37
最近更新
01
安装 Nginx 服务器
01-25
02
安装 Docker 容器
01-25
03
Golang高级编程
01-22
更多文章>
×
×