Git
Git
SSH
github-key —— 私钥
github-key.pub —— 公钥
使用git把某一次commit修改过的文件打包
把新增加的文件使用git add添加进改动
使用git commit提交改动
使用git log查看提交的commit id
使用命令
git diff-tree -r --no-commit-id --name-only 23cde4766b6d879cbae59c5ee9705f5694acb707 | xargs tar -rf mytarfile.tar
快速更新submodule
If it's the first time you check-out a repo you need to use --init first:
git submodule update --init --recursive
For git 1.8.2 or above, the option --remote was added to support updating to latest tips of remote branches:
git submodule update --recursive --remote
如果更新补下来子集,可以直接进入子集文件夹 ,然后clone
下来即可。
把修改的文件打包
两个远程仓库地址
添加远程
git remote add 仓库A url
git remote add 仓库B url
git remote -v
合并其他源到本地分支
git merge remote/branch
GitHub Action Pages
在markdown仓库配置Action Repository secrets时,这里配置的时私钥,需要把私钥的所有内容复制(包括-----BEGIN OPENSSH PRIVATE KEY-----
和最后一行)。在另一个仓库配置Deloy Keys
就是配置公钥,可以不需要配置,如果在账户中设置了SSH的。
SSH 连接不上
既然和GitHub建立ssh连接的时候提示connection refused,那我们就详细看看建立ssh连接的过程中发生了什么,可以使用ssh -v命令,-v表示verbose,会打出详细日志。
$ ssh -vT git@github.com
OpenSSH_9.0p1, OpenSSL 1.1.1o 3 May 2022
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: Connecting to github.com [::1] port 22.
debug1: connect to address ::1 port 22: Connection refused
debug1: Connecting to github.com [127.0.0.1] port 22.
debug1: connect to address 127.0.0.1 port 22: Connection refused
ssh: connect to host github.com port 22: Connection refused
从上面的信息马上就发现了诡异的地方,连接http://github.com的地址居然是::1和127.0.0.1。前者是IPV6的localhost地址,后者是IPV4的localhost地址。
到这里问题就很明确了,是DNS解析出问题了,导致http://github.com域名被解析成了localhost的ip地址,就自然连不上GitHub了。
Windows下执行ipconfig /flushdns 清楚DNS缓存后也没用,最后修改hosts文件,增加一条github.com的域名映射搞定。
140.82.113.4 github.com
查找http://github.com的ip地址可以使用https😕/www.ipaddress.com/来查询,也可以使用nslookup命令
nslookup github.com 8.8.8.8
nslookup是域名解析工具,8.8.8.8是Google的DNS服务器地址。直接使用
nslookup github.com
就会使用本机已经设置好的DNS服务器进行域名解析,ipconfig /all可以查看本机DNS服务器地址。
这个问题其实就是DNS解析被污染了,有2种可能:
DNS解析被运营商劫持了
使用了科学上网工具
按照我上面写的解决方案操作即可解决。