Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issues with fetching via git (GIT_CREDENTIAL_HELPER ?) #127

Open
redeexpressos opened this issue Jul 24, 2024 · 6 comments
Open

Issues with fetching via git (GIT_CREDENTIAL_HELPER ?) #127

redeexpressos opened this issue Jul 24, 2024 · 6 comments

Comments

@redeexpressos
Copy link

Hi.
Im trying to build a recipe that will need git cli access (rust-embedded/meta-rust-bin#185)
I've looked at docs and found GIT_CREDENTIAL_HELPER, but not sure how to use it. Can I get some guidance?
Im not sure if the issue is related to meta-rust-bin, or the way I'm using kas.

@fmoessbauer
Copy link
Member

Hi, does the fetch work if running it without kas? Before using the credential helper, did you try the following:

  • running an ssh agent (auto-forwarded into kas, when SSH_AUTH_SOCK is set, for kas-container, use --ssh-agent)
  • using password-less ssh keys (auto-forwarded into kas, for kas-container use --ssh-dir ~/.ssh)

Further, please also check if git rewrites (insteadof) are needed. In case you run in a CI (like GitHub actions), you probably can use webfactory/ssh-agent. This is detected by kas and the environment is prepared accordingly.

I would also recommend to have a look at the Credential Handling part of our docs.

@redeexpressos
Copy link
Author

Im not sure if I can fetch Rust crates via ssh, since they are based on http. On my "local setup", when I build the software, the program usually asks for git "username" and "password". I suppose this is failing because kas cant provide these fields automatically

@fmoessbauer
Copy link
Member

Im not sure if I can fetch Rust crates via ssh, since they are based on http

This definitely works, but you need to setup the insteadof rules. Example: git config url."ssh://[email protected]".insteadOf "https://github.com" (or vice versa). Please also see https://kas.readthedocs.io/en/latest/userguide/credentials.html#git-configuration

the program usually asks for git "username" and "password".

You can add these to a .netrc file and set NETRC_FILE=<path/to/.netrc>.

There are various options. Once you find a working combination, please also let us know, so we can add this example to the documentation.

@redeexpressos
Copy link
Author

redeexpressos commented Jul 25, 2024

Ok. After putting the ssh... insteadOF https ... Im having a different error now, related to known hosts:

| Caused by:
|   error: unknown SSH host key
|   The SSH host key for `abc.def.com` is not known and cannot be validated.

Im using SSH_AUTH_SOCK='true'. Am I missing something?

Looks like I am misuing ssh_auth_sock, but can't see any examples on this without running manually ssh-agent and passing the agent...

@redeexpressos
Copy link
Author

Ive tried the NETRC method.

machine https://abc.def.com
login my.name
password yes

but looks like its attempting login per repository instead :|

@redeexpressos
Copy link
Author

redeexpressos commented Jul 25, 2024

Weird, looks like this is more an issue for Cargo and meta-rust-bin than here. After passing the NETRC file, I can git clone stuff from abc.def, but my recipe fails.
Ran out of ideas.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants