Search code examples
githubyoctobitbake

Yocto - fetch private repo using https


Hello stackoverflow community,

I'm working with Yocto 2.2 (Morty) and I would like to configure a recipe that fetch a private github repo using https protocol. I can do it with ssh but my constraint is to be machine-independant so https it better.

I'm expecting bitbake, when performing the do_fetch() feature, to ask me for my username and password but couldn't get this result yet.

My recipe is configured like this:

SRC_URI = "gitsm://github.com/ORGANISATION/my-depot.git;branch=master;protocol=https"

Running bitbake gives me the following error:

Fetcher failure: [...] git -c core.fsyncobjectfiles=0 ls-remote https://github.com/ORGANISATION/my-depot.git failed with exit code 128, output: fatal: could not read Username for 'https://github.com': No such device or address

However, if I copy paste the following command in my terminal, i get the Username prompt:

git -c core.fsyncobjectfiles=0 ls-remote https://github.com/ORGANISATION/my-depot.git
Username for 'https://github.com':

Any idea ?

EDIT: Note that i also don't want my credentials to appear in the SRC_URI flag.


Solution

  • You can store the username and password in .gitconfig. If you don't want to store password as plain text in .gitconfig, use cntlm.

    One useful answer is here: stackoverflow.com/a/13230636/2689839

    After configuring CNTLM,

    git config --global https.proxy https://127.0.0.1:port
    git config --global http.proxy http://127.0.0.1:port