使用SSH访问GitHub时bitbake recipietool的命令格式及报错解决
使用BitBake recipetool通过SSH访问GitHub仓库的正确格式
问题原因分析
从报错信息Unable to resolve 'master' in upstream git repository能定位两个核心问题:
- 直接用
git@github.com:<username>/repo1.git格式时,recipetool错误解析URL,生成了无效的git://git@github.com/...地址 - 目标仓库的默认分支不是
master(当前GitHub新仓库默认分支多为main),导致工具无法匹配到指定分支
正确命令格式
标准BitBake Git URI格式(推荐)
采用BitBake官方支持的Git URI规范,明确指定SSH协议和正确分支:
recipetool create "git://github.com/<username>/repo1.git;protocol=ssh;branch=<your-branch>"
- 替换
<username>为你的GitHub用户名 - 替换
<your-branch>为仓库实际的默认分支(如main)
原生SSH URL格式(带分支指定)
如果偏好原生SSH URL,可通过--srcrev参数直接指定分支:
recipetool create --srcrev <your-branch> git@github.com:<username>/repo1.git
前置验证步骤
- 确认SSH密钥配置正常
先手动验证本地能通过SSH克隆仓库,排除认证问题:
git clone git@github.com:<username>/repo1.git
- 确认仓库分支名称
登录GitHub查看仓库的默认分支,避免使用不存在的分支名(如master)
内容的提问来源于stack exchange,提问作者preetam
相关产品推荐
相关产品推荐

