手机浏览 RSS 2.0 订阅 膘叔的简单人生 , 腾讯云RDS购买 | 超便宜的Vultr , 注册 | 登陆
浏览模式: 标准 | 列表分类:苹果相关

git fetch --unshadow出现RPC failed

 远程操作家里的mac mini进行更新的时候,突然报错:

XML/HTML代码
  1. mini:Homebrew mini$ brew update  
  2. Warning: No available formula with the name "ca-certificates".  
  3. ==> Searching for similarly named formulae...  
  4. Error: No similarly named formulae found.  
  5. ==> Searching for a previously deleted formula (in the last month)...  
  6. Warning: homebrew/core is shallow clone. To get its complete history, run:  
  7.   git -C "$(brew --repo homebrew/core)" fetch --unshallow  
  8.   
  9. Error: No previously deleted formula found.  
  10. ==> Searching taps on GitHub...  
  11. Error: No formulae found in taps.  
  12. Error:  
  13.   homebrew-core is a shallow clone.  
  14. To `brew update`, first run:  
  15.   git -C /usr/local/Homebrew/Library/Taps/homebrew/homebrew-core fetch --unshallow  
  16. This command may take a few minutes to run due to the large size of the repository.  
  17. This restriction has been made on GitHub's request because updating shallow  
  18. clones is an extremely expensive operation due to the tree layout and traffic of  
  19. Homebrew/homebrew-core and Homebrew/homebrew-cask. We don't do this for you  
  20. automatically to avoid repeatedly performing an expensive unshallow operation in  
  21. CI systems (which should instead be fixed to not use shallow clones). Sorry for  
  22. the inconvenience!  
于是执行 git -C /usr/local/Homebrew/Library/Taps/homebrew/homebrew-core fetch --unshallow  ,然而执行下来还是:
XML/HTML代码
  1. error: RPC failed; HTTP 504 curl 22 The requested URL returned error: 504 Gateway Time-out  
  2. fatal: the remote end hung up unexpectedly  
 
然后我就用打开git trace进行查看:
XML/HTML代码
  1. GIT_TRACE=2 git -C /usr/local/Homebrew/Library/Taps/homebrew/homebrew-core fetch --unshallow  
  2. 10:29:28.798061 exec-cmd.c:139          trace: resolved executable path from Darwin stack: /Applications/Xcode.app/Contents/Developer/usr/bin/git  
  3. 10:29:28.798668 exec-cmd.c:236          trace: resolved executable dir: /Applications/Xcode.app/Contents/Developer/usr/bin  
  4. 10:29:28.799328 git.c:418               trace: built-in: git fetch --unshallow  
  5. 10:29:28.801482 run-command.c:643       trace: run_command: GIT_DIR=.git git-remote-https origin https://mirrors.ustc.edu.cn/homebrew-core.git  
  6. 10:29:28.812513 exec-cmd.c:139          trace: resolved executable path from Darwin stack: /Applications/Xcode.app/Contents/Developer/usr/libexec/git-core/git-remote-https  
  7. 10:29:28.813122 exec-cmd.c:236          trace: resolved executable dir: /Applications/Xcode.app/Contents/Developer/usr/libexec/git-core  
  8. 10:29:28.929816 run-command.c:643       trace: run_command: git fetch-pack --stateless-rpc --stdin --lock-pack --include-tag --thin --depth=2147483647 https://mirrors.ustc.edu.cn/homebrew-core.git/  
  9. 10:29:28.935164 exec-cmd.c:139          trace: resolved executable path from Darwin stack: /Applications/Xcode.app/Contents/Developer/usr/libexec/git-core/git  
  10. 10:29:28.935863 exec-cmd.c:236          trace: resolved executable dir: /Applications/Xcode.app/Contents/Developer/usr/libexec/git-core  
  11. 10:29:28.936585 git.c:418               trace: built-in: git fetch-pack --stateless-rpc --stdin --lock-pack --include-tag --thin --depth=2147483647 https://mirrors.ustc.edu.cn/homebrew-core.git/  
  12. error: RPC failed; HTTP 504 curl 22 The requested URL returned error: 504 Gateway Time-out  
  13. fatal: the remote end hung up unexpectedly  
这个。。--depth=2147483647,居然这么深?
查到了网上的方案,参考在这里:记录: homebrew-core is a shallow clone - 腾讯云开发者社区-腾讯云 (tencent.com),我按上面的操作,删除了homebrew-core,homebrew-cask,再进行upgrade,果然 正常了。
 
---
在非正常之前,做了不少操作,比如用官方的uninstall脚本清除了系统,然而也没有什么用。所幸,现在正常了。
 
 

mac下使用podman的代理大坑

关于这podman啊,一天天的,都在说要替换docker,然后也是大家各种说怎么弄怎么弄,教你安装podman之后,alias docker="podman" ,然后pip3 install podman-compose,再alias一条 alias docker-compose="podman-compose",说的这样好象就差不多了

 
确实,正常情况下,或者在linux\wsl的情况下,应该是差不多的,虽然部分命令不一样,但看一看参数,基本上也就过了。。。
mac下确实有一个大坑。因为mac其实是不支持container这玩意的。所以不管是docker也好,谁也好,都得装虚拟机。。。
早期podman的教程大多是让你安装一个ubuntu出的multipass,然后再各种连接,用podman连接远程(就是multipass出来的ubuntu虚拟机中安装一个podman)。。。手续也烦,教程也复杂。所以官方升级后出了一个简化版本:podman machine init/podman machine start。然后就可以各种操作了,确实方便很多。
 
然而问题也正是发生在这里。
> 且看我一步步操作
* brew update && brew install podman 
    * 正常更新,但由于有部分文件在raw.githubusercontent.com上,遇到这个,代表你只能用代理 了。于是ctrl+c
* export http_proxy=127.0.0.1:1087;export https_proxy=127.0.0.1:1087;export all_proxy=127.0.0.1:1080
* 再次执行:brew update&& brew install podman
    *顺利执行完
* podman machine init && podman machine start
    * 没问题,但这里要吐槽一下,安装的是fedora。。。好吧,我忍了。我纠结的是,为什么不能选择宿主操作系统?
* podman pull mysql
    * 问题就出来这里,拉包的时候,报错
```
podman create --name=pl-and-si-mysql-db --label io.podman.compose.config-hash=123 --label io.podman.compose.project=pipeline_combined_db --label io.podman.compose.version=0.0.1 --label com.docker.compose.project=pipeline_combined_db --label com.docker.compose.project.working_dir=/Users/gouki/Desktop/SC-REDBACK-main/database/pipeline_combined_db --label com.docker.compose.project.config_files=docker-compose.yaml --label com.docker.compose.container-number=1 --label com.docker.compose.service=pl-and-si-db -e MYSQL_DATABASE=database -e MYSQL_ROOT_PASSWORD=password -v pipeline_combined_db_pl_and_si_database_folder:/var/lib/mysql -v /Users/gouki/Desktop/SC-REDBACK-main/database/pipeline_combined_db/allInOne.sql:/docker-entrypoint-initdb.d/1.sql --net pipeline_combined_db_default --network-alias pl-and-si-db -p 3306:3306 --restart always --cpus 0.4 -m 350m mysql:latest
Resolving "mysql" using unqualified-search registries (/etc/containers/registries.conf.d/999-podman-machine.conf)
Trying to pull docker.io/library/mysql:latest...
Error: initializing source docker://mysql:latest: pinging container registry registry-1.docker.io: Get "https://registry-1.docker.io/v2/": proxyconnect tcp: dial tcp 127.0.0.1:1087: connect: connection refused
```
 
咦,他走了代理 ,但被拒绝?不可能啊,我前面下载软件的时候不是还好好的么,难道是代理错误?于是我新开一个shell窗口,再次执行,仍然是同样的错误,这回就发现问题了,因为新的shell窗口我env|grep -i proxy的时候,返回为空,当前进程没有任何一个proxy参数
 
找了一堆podman的配置,打印了podman info也没有找到有代理 设置的地方,最后只能问google。搜索了半天,只搜到一个有效贴,还是在官方的[issue](failed to pull image when use system proxy · Issue #14087 · containers/podman (github.com))里
 
有人这样回复:
```

The proxy is set correctly: proxyconnect tcp: dial tcp 127.0.0.1:7890: connect: connection refused

The problem is that your proxy is listening on 127.0.0.1. Obviously 127.0.0.1 inside the VM is a different address and therefore it cannot connect to the proxy on you actual host.

If you set http_proxy=socks5://host.containers.internal:7890 before you run podman machine init it should work.
Maybe podman should just s/127.0.0.1/host.containers.internal and s/localhost/host.containers.internal automatically when it copies the proxy value from the host.

```
 
感情是你只要machine init的之前用了代理 ,init完后。针对vm的参数就变了。于是下面就有人说,你可以这样:
 
```

I just test it and I think you are right, but I don't know why http_proxy=socks5://host.containers.internal:7890 podman machine init this command still hit the same error but it works as expected when I add 127.0.0.1 host.containers.internal to my host file

however it works now

add item blow to host file

127.0.0.1 host.containers.internal

and change proxy to

http_proxy=socks5://host.containers.internal:7890

then everything works fine

much thanks @Luap99 for your help and I close this issues for the problem is solved, but I still stay concerned if some day podman can do this itself and no need to change proxy setting

```

 

呵呵,这么麻烦?我还是新建一个shell窗口:podman machine stop && podman machine init && podman machine start吧。

然后,podman pull mysql,一切正常~

 

至此搞定。

 

> 假装内容支持markdown,因为新模板在寻找中,现在的html所见所得,估计会全部改成markdown,先尝试一下。

 
 

实话实说,苹果的通用控制让我省了一台电脑

用M1的时候起初是挺爽的,但后面随着要开的IDE越来越多,16G内存就不够用了。当年最大只有16G,真让人痛苦。

本来想着换吧,但一来,2年的分期还没到,AC啥的都没过期,感觉没意义。二来,家里笔记本真的有点多了。14、18,再加M1,如果再来一台。。。也太占地方了。

原来以为通用控制只能控制PAD,结果 看到电脑也可以控制,这个就太方便了,立即把18拿出来用,32G内存做啥都够了。。就是时不时的风扇会响,自从用了M1,已经几年没有听过风扇的声音了。。。。真不知道以前18款那2年我是怎么用过来的。。

顺便再说一个,M1最大只能接一个外置显示器,用通用控制后,可以不使用镜像,而用作扩展显示器,一下子,相当于变成2个外接显示器了。。。

所以。。。是当成第二台电脑,还是当成第二台显示器,就看心情了。。HOHO

Tags: 通用控制

mac触摸版3指以上功能失效的解决方法

 在使用mac的时候,偶尔会出现触摸板3指以上的功能失效,这个太影响使用了,毕竟mac最有用的功能,我感觉就是窗口切换。。。触摸板在外接键盘后,这就是我唯一的功能了,如果他也失效,那实在令人痛苦

 
这时候有一个快速解决方案,那就是:打开活动监视器,找到程序坞,强制退出,这时候程序坞会自动重启,再试一下三指功能,恢复正常~
或者终端,killall Dock。也是同样的原理~

brew install php-imap

 由于我系统中的php是通过brew install 进行安装的。因此当遇到imap要使用的时候发现没法安装,因为我直接brew install php@7.4-imap无效。

网上找了点资料,发现还是得使用新的命令
 
1、brew tap shivammathur/php (这句应该是已经有了,因为php@7.4就是通过这个资源进行安装的)
2、brew tap shivammathur/extensions ,
3、brew install imap@7.4

然后系统会下载和更新库,主要是用了imap-uw和openssl扩展。一堆download和install后,运行 php -m|grep imap,发现已经OK了
Records:22412345678910»