作者
digoal
日期
2021-01-31
标签
PostgreSQL , github , depth
背景
先使用以下文档提供的方法,
《github clone 的一般错误(timeout 超时, RPC failed 等)处理方法, 以及加速方法》
1、改git config配置
git config --global http.postBuffer 10485760000
git config --global http.lowSpeedLimit 0
git config --global http.lowSpeedTime 999999
2、使用fast github 中转
最常见GitHub镜像地址:
https://hub.fastgit.org/
https://github.com.cnpmjs.org/
例如
git clone https://hub.fastgit.org/digoal/blog
3、dns被篡改, 使用ipaddress.com得到正常的hosts, 并写入本地hosts文件
http://github.global.ssl.fastly.net.ipaddress.com/#ipinfo
http://github.com.ipaddress.com/#ipinfo
......
http://??????.ipaddress.com/#ipinfo
sudo vi /etc/hosts
```
GitHub Start 20210119有效(包括MAC系统)20210123
140.82.114.4 github.com
199.232.69.194 github.global.ssl.fastly.net
140.82.113.3 github.com
140.82.114.20 gist.github.com
151.101.184.133 assets-cdn.github.com
151.101.184.133 raw.githubusercontent.com
199.232.28.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
199.232.96.133 avatars.githubusercontent.com
151.101.184.133 avatars0.githubusercontent.com
199.232.68.133 avatars0.githubusercontent.com
199.232.28.133 avatars0.githubusercontent.com
199.232.28.133 avatars1.githubusercontent.com
151.101.184.133 avatars1.githubusercontent.com
151.101.108.133 avatars1.githubusercontent.com
151.101.184.133 avatars2.githubusercontent.com
199.232.28.133 avatars2.githubusercontent.com
151.101.184.133 avatars3.githubusercontent.com
199.232.68.133 avatars3.githubusercontent.com
151.101.184.133 avatars4.githubusercontent.com
199.232.68.133 avatars4.githubusercontent.com
151.101.184.133 avatars5.githubusercontent.com
199.232.68.133 avatars5.githubusercontent.com
151.101.184.133 avatars6.githubusercontent.com
199.232.68.133 avatars6.githubusercontent.com
151.101.184.133 avatars7.githubusercontent.com
199.232.68.133 avatars7.githubusercontent.com
151.101.184.133 avatars8.githubusercontent.com
199.232.68.133 avatars8.githubusercontent.com
199.232.96.133 avatars9.githubusercontent.com
GitHub End
```
4、关闭压缩
git config --global core.compression 0
5、然后使用depth这个指令来下载最近一次提交
git clone https://github.com/digoal/blog --depth 1
然后获取完整库
```
git fetch --unshallow
或
git fetch --depth=2147483647
最后pull一下查看状态,问题解决
git pull --all
```
更多可以查看man git-clone
```
--depth
Create a shallow clone with a history truncated to the specified number of commits. Implies --single-branch unless --no-single-branch is given to fetch the histories near
the tips of all branches. If you want to clone submodules shallowly, also pass --shallow-submodules.
--shallow-since=<date>
Create a shallow clone with a history after the specified time.
--shallow-exclude=<revision>
Create a shallow clone with a history, excluding commits reachable from a specified remote branch or tag. This option can be specified multiple times.
--[no-]single-branch
Clone only the history leading to the tip of a single branch, either specified by the --branch option or the primary branch remote's HEAD points at. Further fetches into
the resulting repository will only update the remote-tracking branch for the branch this option was used for the initial cloning. If the HEAD at the remote did not point
at any branch when --single-branch clone was made, no remote-tracking branch is created.
```
6、还是配置
```
vi ~/.gitconfig
或者用git config --global命令修改配置
```
```
[core]
packedGitLimit = 512m
packedGitWindowSize = 512m
[pack]
deltaCacheSize = 2047m
packSizeLimit = 2047m
windowMemory = 2047m
```
使用ssh clone
如果以上方法还是不行,例如超过1GB的仓库(使用depth 1后依旧超过1GB),如果这个仓库是你自己的,可以使用ssh来克隆。
打开github网站,找到你的仓库,点击code下拉框,里面有ssh clone地址。 克隆命令一样, 需要在客户端创建pub key, 同时将pub key配置到你的github setting中。
可以开启compress
git config --global core.compression -1
升级git版本
如果你的git版本很低, 可以考虑升级版本。
git常用命令
git常用命令整理
一、基础命令
```
git clone:这是一种较为简单的初始化方式
git init 和 git remote:这种方式稍微复杂一些,当你本地创建了一个工作目录,你可以进入这个目录,使用'git init'命令进行初始化
git remote add 命令来增加一个远程服务器端,例如:git remote add origin git://github.com/jQuery/jquery.git
```
二、 Git 常用命令
1) 远程仓库相关命令
检出仓库: $ git clone git://github.com/jQuery/jquery.git
查看远程仓库:$ git remote -v
添加远程仓库:$ git remote add [name] [url]
删除远程仓库:$ git remote rm [name]
修改远程仓库:$ git remote set-url --push [name] [newUrl]
拉取远程仓库:$ git pull [remoteName] [localBranchName]
推送远程仓库:$ git push [remoteName] [localBranchName]
*如果想把本地的某个分支test提交到远程仓库,并作为远程仓库的master分支,或者作为另外一个名叫test的分支,如下:
$ git push origin test:master // 提交本地test分支作为远程的master分支
$ git push origin test:test // 提交本地test分支作为远程的test分支
2)分支(branch)操作相关命令
查看本地分支:$ git branch
查看远程分支:$ git branch -r
创建本地分支:$ git branch [name] #注意新分支创建后不会自动切换为当前分支
切换分支:$ git checkout [name]
创建新分支并立即切换到新分支:$ git checkout -b [name]
删除分支:$ git branch -d [name] # -d选项只能删除已经参与了合并的分支,对于未有合并的分支是无法删除的。如果想强制删除一个分支,可以使用-D选项
合并分支:$ git merge [name] #将名称为[name]的分支与当前分支合并
创建远程分支(本地分支push到远程):$ git push origin [name]
删除远程分支:$ git push origin :heads/[name] 或 $ gitpush origin :[name]
创建空的分支:(执行命令之前记得先提交你当前分支的修改,否则会被强制删干净没得后悔)
$ git symbolic-ref HEAD refs/heads/[name]
$ rm .git/index
$ git clean -fdx
3)版本(tag)操作相关命令
查看版本:$ git tag
创建版本:$ git tag [name]
删除版本:$ git tag -d [name]
查看远程版本:$ git tag -r
创建远程版本(本地版本push到远程):$ git push origin [name]
删除远程版本:$ git push origin :refs/tags/[name]
合并远程仓库的tag到本地:$ git pull origin --tags
上传本地tag到远程仓库:$ git push origin --tags
创建带注释的tag:$ git tag -a [name] -m 'yourMessage'
4) 子模块(submodule)相关操作命令
```
添加子模块:$ git submodule add [url] [path]
如:$git submodule add git://github.com/soberh/ui-libs.git src/main/webapp/ui-libs
初始化子模块:$ git submodule init # 只在首次检出仓库时运行一次就行
更新子模块:$ git submodule update # 每次更新或切换分支后都需要运行一下
删除子模块:(分4步走哦)
1) $ git rm --cached [path]
2) 编辑".gitmodules"文件,将子模块的相关配置节点删除掉
3) 编辑" .git/config"文件,将子模块的相关配置节点删除掉
4) 手动删除子模块残留的目录
5)忽略一些文件、文件夹不提交
在仓库根目录下创建名称为".gitignore"的文件,写入不需要的文件夹名或文件,每个元素占一行即可,如
target
bin
*.db
```
三、 git 命令详解
```
①git pull:从其他的版本库(既可以是远程的也可以是本地的)将代码更新到本地,例如:‘git pull origin master’就是将origin这个版本库的代码更新到本地的master主枝
②git add:是将当前更改或者新增的文件加入到Git的索引中,加入到Git的索引中就表示记入了版本历史中,这也是提交之前所需要执行的一步,例如’git add app/model/user.rb’就会增加app/model/user.rb文件到Git的索引中
③git rm:从当前的工作空间中和索引中删除文件,例如’git rm app/model/user.rb’
④git commit:提交当前工作空间的修改内容,例如’git commit -m story #3, add user model’,提交的时候必须用-m来输入一条提交信息,该功能类似于SVN的commit
⑥git push:将本地commit的代码更新到远程版本库中,例如’git push origin’就会将本地的代码更新到名为orgin的远程版本库中
⑦git log:查看历史日志
⑧git revert:还原一个版本的修改,必须提供一个具体的Git版本号,例如’git revert bbaf6fb5060b4875b18ff9ff637ce118256d6f20’,Git的版本号都是生成的一个哈希值
上面的命令几乎都是每个版本控制工具所公有的,下面就开始尝试一下Git独有的一些命令:
⑨git branch:对分支的增、删、查等操作,例如’git branch new_branch’会从当前的工作版本创建一个叫做new_branch的新分支,'git branch -D new_branch’就会强制删除叫做new_branch的分支,'git branch’就会列出本地所有的分支
⑩git checkout:Git的checkout有两个作用,其一是在不同的branch之间进行切换,例如’git checkout new_branch’就会切换到new_branch的分支上去;另一个功能是还原代码的作用,例如’git checkout app/model/user.rb’就会将user.rb文件从上一个已提交的版本中更新回来,未提交的内容全部会回滚
⑪git rebase:实际上是将分支点从C移到了G,这样分支也就具有了从C到G的功能
⑫git reset:将当前的工作目录完全回滚到指定的版本号,假设我们有A-G五次提交的版本,其中C的版本号是 bbaf6fb5060b4875b18ff9ff637ce118256d6f20,我们执行了’git reset bbaf6fb5060b4875b18ff9ff637ce118256d6f20’那么结果就只剩下了A-C三个提交的版本
⑬git stash:将当前未提交的工作存入Git工作栈中,时机成熟的时候再应用回来
⑭git config:利用这个命令可以新增、更改Git的各种设置,例如’git config branch.master.remote origin’就将master的远程版本库设置为别名叫做origin版本库
⑮git tag:可以将某个具体的版本打上一个标签,这样你就不需要记忆复杂的版本号哈希值了,例如你可以使用’git tag revert_version bbaf6fb5060b4875b18ff9ff637ce118256d6f20’来标记这个被你还原的版本,那么以后你想查看该版本时,就可以使用 revert_version标签名,而不是哈希值了
Git
```
PostgreSQL 许愿链接
您的愿望将传达给PG kernel hacker、数据库厂商等, 帮助提高数据库产品质量和功能, 说不定下一个PG版本就有您提出的功能点. 针对非常好的提议,奖励限量版PG文化衫、纪念品、贴纸、PG热门书籍等,奖品丰富,快来许愿。开不开森.
9.9元购买3个月阿里云RDS PostgreSQL实例
PostgreSQL 解决方案集合
德哥 / digoal's github - 公益是一辈子的事.




