1

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.

Martin
  • 877
  • 8
  • 20
  • 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: https://stackoverflow.com/a/13230636/2689839 – Parthiban Dec 06 '18 at 18:23
  • Thank you for this suggestion Parthiban, that was helpful. I didn't know git could store credentials. If you want, comment it as an asnwer, i'll mark it as the solution. – Martin Dec 26 '18 at 13:41
  • Sure, I will add it as answer now! – Parthiban Dec 26 '18 at 13:45
  • You can also try https://stackoverflow.com/a/64587959/2443502. – Marcin Kłopotek Oct 29 '20 at 11:08

1 Answers1

2

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
Parthiban
  • 2,130
  • 2
  • 14
  • 27