From 426f5ccdd3fceee33e82c41eb3b71506290e3b42 Mon Sep 17 00:00:00 2001 From: Jairo Llopis <973709+yajo@users.noreply.github.com> Date: Sat, 21 Sep 2024 07:09:36 +0100 Subject: [PATCH] docs(git): tell how to pass HTTPS credentials (#1782) Fixes https://github.com/copier-org/copier/issues/466 --- docs/faq.md | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/docs/faq.md b/docs/faq.md index 99e75d241..f1a41c884 100644 --- a/docs/faq.md +++ b/docs/faq.md @@ -192,3 +192,22 @@ $ copier copy -r HEAD ./src ./dst ... then you'll notice `new-file.txt` does exist. You passed a specific ref to copy, so Copier skips its autodetection and just goes for the `HEAD` you already chose. + +## How to pass credentials to Git? + +If you do something like this, and the template supports updates, you'll notice that the +credentials will end up stored in [the answers file][file][the-copier-answersyml-file]: + +```shell +copier copy https://myuser:example.com/repo.git . +``` + +To avoid that, the simplest fix is to clone using SSH with cryptographic key +authentication. If you cannot do that, then check out these links for strategies on +passing HTTPS credentials to Git: + +- https://github.com/copier-org/copier/issues/466#issuecomment-2338160284 +- https://stackoverflow.com/q/35942754 +- https://git-scm.com/docs/gitcredentials +- https://git-scm.com/book/en/v2/Git-Tools-Credential-Storage#_credential_caching +- https://github.com/topics/git-credential-helper