Search code examples
gitubuntu-16.04yoctobitbake

How to use a private git repo while building yocto using bitbake in Ubuntu 16.04?


While using bitbake after configuring , bitbake failed before trying to clone/access a private repository using an SSH link .

$ 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'

When i try to remove the ~/ from the URL i get a similar error .

| 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.

I even tried modifying the URL to https: , on which it gave me another error

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'

When i tried the same in the terminal instead of bitbake , It succeeded with the desired output

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

I am using Ubuntu 16.04 . I know that Yocto build is not tested in 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.

But a previous build with public repositories succeeded . So is there a way to make this work ?


Solution

  • Try using:

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

    in your SRC_URI.

    Note the removal of :~.