Cocoapods fatal: Remote branch #{s.version} not found in upstream origin

本文解决了一个特定的git clone错误,该错误出现在验证podspec文件时,表现为无法找到远程分支。问题源于podspec文件中特殊字符的不当替换。通过将错误的字符替换回正确的形式,问题得以解决。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

遇到一个错误:

fatal: Remote branch #{s.version} not found in upstream origin
复制代码

解决办法

  • 网上搜了很多,都无效
  • 可能仅适用我的情况,分享出来看看?(万一有遇到相似的呢)

podspec 文件 替换成 "

详细信息:

$ pod spec lint	

;49m -> XXXXX (0.0.4)
    - WARN  | source: The version should be included in the Git tag.
    - ERROR | [iOS] unknown: Encountered an unknown error (;49m[!] /usr/bin/git clone https://github.com/XXXXX/XXXXX.git /var/folders/m3/_w136hjd7w37766lrqbndsdw0000gn/T/d20180928-83208-x4huy2 --template= --single-branch --depth 1 --branch #{s.version}	

Cloning into '/var/folders/m3/_w136hjd7w37766lrqbndsdw0000gn/T/d20180928-83208-x4huy2'...
warning: Could not find remote branch #{s.version} to clone.
fatal: Remote branch #{s.version} not found in upstream origin
) during validation.	

Analyzed 1 podspec.	

;49m[!] The spec did not pass validation, due to 1 error and 1 warning.
复制代码

从Github上看,一切都没有问题,直接执行:

/usr/bin/git clone https://github.com/XXXXX/XXXXX.git /var/folders/m3/_w136hjd7w37766lrqbndsdw0000gn/T/d20180928-83208-x4huy2 --template= --single-branch --depth 1 --branch 0.0.4
复制代码

也可以Clone下来,百思不得其解,最后对比了一下之前的Tag,发现做了一次 podspec 文件 "' 的替换,替换回来试了试,竟然搞定了!!!!!

转载于:https://juejin.im/post/5bae390d5188255c6e706dfb

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值