如何在Ubuntu 16.04中使用bitbake构建yocto时使用私有git repo?

时间:2017-08-09 14:00:33

标签: git ubuntu-16.04 yocto bitbake

配置后使用bitbake时,bitbake在尝试使用SSH链接克隆/访问私有存储库之前失败。

$ bitbake linux-imx
git -c core.fsyncobjectfiles=0 ls-remote ssh://git@gitlab.com:~/some-project/some-repo.git
| DEBUG: Python function base_do_fetch finished
| DEBUG: Python function do_fetch finished
| ERROR: Function failed: Fetcher failure: Fetch command failed with exit code 128, output:
| ssh: Could not resolve hostname gitlab.com:~: Name or service not known
| fatal: Could not read from remote repository.
| 
| Please make sure you have the correct access rights
| and the repository exists.
| 
ERROR: Task 4 (/home/user/Projects/some_project/some-project-release-bsp/sources/meta-fsl-bsp-release/imx/meta-bsp/recipes-kernel/linux/linux-imx_4.1.15.bb, do_fetch) failed with exit code '1'

当我尝试从网址中删除~/时,我收到了类似的错误。

| DEBUG: Python function base_do_fetch finished
| DEBUG: Python function do_fetch finished
| ERROR: Function failed: Fetcher failure: Fetch command failed with exit code 128, output:
| ssh: Could not resolve hostname gitlab.com:some-project: Name or service not known
| fatal: Could not read from remote repository.

我甚至尝试将网址修改为https:,但是它给了我另一个错误

git -c core.fsyncobjectfiles=0 ls-remote http://gitlab.com/some-project/some-repo.git
| DEBUG: Python function base_do_fetch finished
| DEBUG: Python function do_fetch finished
| ERROR: Function failed: Fetcher failure: Fetch command failed with exit code 128, output:
| fatal: could not read Username for 'https://gitlab.com': No such device or address
| 
ERROR: Task 4 (/home/user/Projects/some-project/some-project-release-bsp/sources/meta-fsl-bsp-release/imx/meta-bsp/recipes-kernel/linux/linux-imx_4.1.15.bb, do_fetch) failed with exit code '1'

当我在终端中尝试相同而不是bitbake时,它成功地获得了所需的输出

git -c core.fsyncobjectfiles=0 ls-remote git@gitlab.com:some-project/some-repo.git

我使用的是Ubuntu 16.04。我知道Yocto build没有在Ubuntu 16.04中测试过。

WARNING: Host distribution "Ubuntu-16.04" has not been validated with this version of the build system; you may possibly experience unexpected failures. It is recommended that you use a tested distribution.

但是之前使用公共存储库的构建成功了。那么有没有办法使这项工作?

2 个答案:

答案 0 :(得分:1)

尝试使用:

git://git@gitlab.com/some-project/some-repo.git;protocol=‌​ssh;branch=${SRCBRAN‌​CH}
在您的SRC_URI中

请注意删除:~

答案 1 :(得分:0)

这与Yocto如何从gitlab获取源代码有关。无论存储库是公共的还是私有的,git链接都不起作用。

我经常搜索,但找不到理由。所以,我不得不将我的存储库移动到github。当它切换到github时它会工作。

另一种方法是将您的源提取到本地并编辑配方以从那里获取源。