richardmyu / blog

个人(issues)博客
https://github.com/richardmyu/blog/issues
MIT License
0 stars 0 forks source link

Git/Github 的一些问题记录 #14

Open richardmyu opened 3 years ago

richardmyu commented 3 years ago

1.图片失效

最近发现 Github 打开很慢(虽然习惯了),但是图片也是经常性的挂了。。。后来查了查,是:官方更新了DNS,但是 DNS 缓存没有被更新,导致错误解析【最新】解决Github网页上图片显示失败的问题

解决办法:

修改hosts,打开文件

C:\Windows\System32\drivers\etc\hosts

在文件末尾添加:

# GitHub Start 
192.30.253.112    Build software better, together 
192.30.253.119    gist.github.com
151.101.184.133    assets-cdn.github.com
151.101.184.133    raw.githubusercontent.com
151.101.184.133    gist.githubusercontent.com
151.101.184.133    cloud.githubusercontent.com
151.101.184.133    camo.githubusercontent.com
151.101.184.133    avatars0.githubusercontent.com
151.101.184.133    avatars1.githubusercontent.com
151.101.184.133    avatars2.githubusercontent.com
151.101.184.133    avatars3.githubusercontent.com
151.101.184.133    avatars4.githubusercontent.com
151.101.184.133    avatars5.githubusercontent.com
151.101.184.133    avatars6.githubusercontent.com
151.101.184.133    avatars7.githubusercontent.com
151.101.184.133    avatars8.githubusercontent.com

 # GitHub End

解决github图片不显示的问题

GitHub 图片加载不出来怎么办

进入了 2021 年,这个问题又复现了,这种静态方法应当不适用了。用了插件来解决访问/下载慢的问题,图片没有解决,决定不管图片了。

2.gitee 图床

使用 Gitee 作图床,主要是利用了 Gitee Pages 功能。需要注意的是,修改文件名,或者新增图片,都需要手动 “更新” Gitee Pages 才能获得可访问的 URL。如果是付费用户,那当我没说。。。

3.加速访问

最近访问慢不说,克隆更是要煎熬。。。

解决方法:将 www.github.com 后面添加 .cnpmjs.org/https://www.github.com.cnpmjs.org/projectname),即使用 github 的镜像网站进行访问。

根据实际测试来看:

  1. 使用镜像网站后,下载速度由原来的十几 KB,上升到数百 KB,乃至几 MB;
  2. 使用 HTTPS 协议的克隆可以使用镜像网站,而使用 @git 无法使用,其他方法并没有试过(SSL。。。)

git clone一个github上的仓库,太慢...


用上了dev-sidecar,这个问题一并解决了。

richardmyu commented 3 years ago

4..git 文件过大,被限制上传

这个问题发生在图床仓库,由于多次修改图片,而且图片数量也比较多,导致某次提交后,被警告上传的文件超过 1 G(gitee),只有三次上传机会了。于是带着这个问题,搜索了一番。

最后使用了最暴力的方法:删库重建(因为简单 :joy:)。


参考:

1.如何解决 GitHub 提交次数过多导致 .git 文件过大的问题?彻底删除git中的大文件 2.如何解决 GitHub 提交次数过多 .git 文件过大的问题?

richardmyu commented 2 years ago

5.Host key verification failed

今天推送代码失败:

@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@       WARNING: POSSIBLE DNS SPOOFING DETECTED!          @
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
The RSA host key for github.com has changed,
and the key for the corresponding IP address 223.75.236.241
is unknown. This could either mean that
DNS SPOOFING is happening or the IP address for the host
and its host key have changed at the same time.
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@    WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED!     @
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
IT IS POSSIBLE THAT SOMEONE IS DOING SOMETHING NASTY!
Someone could be eavesdropping on you right now (man-in-the-middle attack)!
It is also possible that a host key has just been changed.
The fingerprint for the RSA key sent by the remote host is
SHA256:rEmlJenVMSL5GVemSY0Gk8WGw6B4ege4J85M+vup8R0.
Please contact your system administrator.
Add correct host key in /c/Users/yum/.ssh/known_hosts to get rid of this message.
Offending RSA key in /c/Users/yum/.ssh/known_hosts:1
RSA host key for github.com has changed and you have requested strict checking.
Host key verification failed.
fatal: Could not read from remote repository.

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

要在 .ssh/known.host 的第二行添加主机密钥。

使用 ssh -T -v git@github.com 看看详细信息:

➜ ssh -T -v git@github.com
OpenSSH_for_Windows_8.6p1, LibreSSL 3.4.3
debug1: Authenticator provider $SSH_SK_PROVIDER did not resolve; disabling
debug1: Connecting to github.com [223.75.236.241] port 22.
debug1: Connection established.
debug1: identity file C:\\Users\\yum/.ssh/id_rsa type 0
debug1: identity file C:\\Users\\yum/.ssh/id_rsa-cert type -1
debug1: identity file C:\\Users\\yum/.ssh/id_dsa type -1
debug1: identity file C:\\Users\\yum/.ssh/id_dsa-cert type -1
debug1: identity file C:\\Users\\yum/.ssh/id_ecdsa type -1
debug1: identity file C:\\Users\\yum/.ssh/id_ecdsa-cert type -1
debug1: identity file C:\\Users\\yum/.ssh/id_ecdsa_sk type -1
debug1: identity file C:\\Users\\yum/.ssh/id_ecdsa_sk-cert type -1
debug1: identity file C:\\Users\\yum/.ssh/id_ed25519 type -1
debug1: identity file C:\\Users\\yum/.ssh/id_ed25519-cert type -1
debug1: identity file C:\\Users\\yum/.ssh/id_ed25519_sk type -1
debug1: identity file C:\\Users\\yum/.ssh/id_ed25519_sk-cert type -1
debug1: identity file C:\\Users\\yum/.ssh/id_xmss type -1
debug1: identity file C:\\Users\\yum/.ssh/id_xmss-cert type -1
debug1: Local version string SSH-2.0-OpenSSH_for_Windows_8.6
debug1: Remote protocol version 2.0, remote software version OpenSSH_7.6
debug1: compat_banner: match: OpenSSH_7.6 pat OpenSSH_7.0*,OpenSSH_7.1*,OpenSSH_7.2*,OpenSSH_7.3*,OpenSSH_7.4*,OpenSSH_7.5*,OpenSSH_7.6*,OpenSSH_7.7* compat 0x04000002
debug1: Authenticating to github.com:22 as 'git'
debug1: load_hostkeys: fopen C:\\Users\\yum/.ssh/known_hosts2: No such file or directory
debug1: load_hostkeys: fopen __PROGRAMDATA__\\ssh/ssh_known_hosts: No such file or directory
debug1: load_hostkeys: fopen __PROGRAMDATA__\\ssh/ssh_known_hosts2: No such file or directory
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: algorithm: curve25519-sha256
debug1: kex: host key algorithm: rsa-sha2-512
debug1: kex: server->client cipher: chacha20-poly1305@openssh.com MAC: <implicit> compression: none
debug1: kex: client->server cipher: chacha20-poly1305@openssh.com MAC: <implicit> compression: none
debug1: expecting SSH2_MSG_KEX_ECDH_REPLY
debug1: SSH2_MSG_KEX_ECDH_REPLY received
debug1: Server host key: ssh-rsa SHA256:rEmlJenVMSL5GVemSY0Gk8WGw6B4ege4J85M+vup8R0
debug1: load_hostkeys: fopen C:\\Users\\yum/.ssh/known_hosts2: No such file or directory
debug1: load_hostkeys: fopen __PROGRAMDATA__\\ssh/ssh_known_hosts: No such file or directory
debug1: load_hostkeys: fopen __PROGRAMDATA__\\ssh/ssh_known_hosts2: No such file or directory
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@    WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED!     @
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
IT IS POSSIBLE THAT SOMEONE IS DOING SOMETHING NASTY!
Someone could be eavesdropping on you right now (man-in-the-middle attack)!
It is also possible that a host key has just been changed.
The fingerprint for the RSA key sent by the remote host is
SHA256:rEmlJenVMSL5GVemSY0Gk8WGw6B4ege4J85M+vup8R0.
Please contact your system administrator.
Add correct host key in C:\\Users\\yum/.ssh/known_hosts to get rid of this message.
Offending RSA key in C:\\Users\\yum/.ssh/known_hosts:2
Host key for github.com has changed and you have requested strict checking.
Host key verification failed.

看来很多帖子后,就增加了一个 config 文件,然后就搞定了 :slightly_smiling_face::slightly_smiling_face::slightly_smiling_face:

Host github.com
User git
Hostname ssh.github.com
PreferredAuthentications publickey
IdentityFile ~/.ssh/id_rsa
Port 443

1.配置SSH连接Git教程 2.ssh 访问github 超时

richardmyu commented 2 years ago

6.cannot spawn more

➜ git tag -l
error: cannot spawn more: No such file or directory
1.0.0

这里面的 more 是一个命令,是 linux 命令。提示信息的意思是没有找到 more 这个命令。

core.pager 该配置项指定 Git 运行诸如 logdiff 等命令所使用的分页器。你可以把它设置成用 more 或者任何你喜欢的分页器(默认用的是 less),当然也可以设置成空字符串,关闭该选项:

$ git config --global core.pager ''

这样不管命令的输出量多少,Git 都会在一页显示所有内容。

git 2.16 以后版本的默认行为。


1.8.1 自定义 Git - 配置 Git

2.git报错 error: cannot spawn more: No such file or directory