diff --git a/cmd/flux/create_secret_git.go b/cmd/flux/create_secret_git.go index e7410ea8dadfe57943af573add64311c5bec1081..446703a02b111ad18bcbe6f9ecba46adf382f5ef 100644 --- a/cmd/flux/create_secret_git.go +++ b/cmd/flux/create_secret_git.go @@ -50,6 +50,13 @@ For Git over HTTP/S, the provided basic authentication credentials are stored in --url=ssh://git@github.com/stefanprodan/podinfo \ --private-key-file=./private.key + # Create a Git SSH authentication secret with a passworded private key from file + # The public SSH host key will still be gathered from the host + flux create secret git podinfo-auth \ + --url=ssh://git@github.com/stefanprodan/podinfo \ + --private-key-file=./private.key \ + --password=<password> + # Create a secret for a Git repository using basic authentication flux create secret git podinfo-auth \ --url=https://github.com/stefanprodan/podinfo \ @@ -140,6 +147,7 @@ func createSecretGitCmdRun(cmd *cobra.Command, args []string) error { opts.PrivateKeyAlgorithm = sourcesecret.PrivateKeyAlgorithm(secretGitArgs.keyAlgorithm) opts.RSAKeyBits = int(secretGitArgs.rsaBits) opts.ECDSACurve = secretGitArgs.ecdsaCurve.Curve + opts.Password = secretGitArgs.password case "http", "https": if secretGitArgs.username == "" || secretGitArgs.password == "" { return fmt.Errorf("for Git over HTTP/S the username and password are required") diff --git a/cmd/flux/create_source_git.go b/cmd/flux/create_source_git.go index b30907378ed7bbf0b92a83ff0591fafca29adcc4..793136ac9661e9f1f09166148a09240437304eaa 100644 --- a/cmd/flux/create_source_git.go +++ b/cmd/flux/create_source_git.go @@ -101,6 +101,15 @@ For private Git repositories, the basic authentication credentials are stored in --branch=master \ --private-key-file=./private.key + # Create a source for a Git repository using SSH authentication and a + # private key with a password from file + # The public SSH host key will still be gathered from the host + flux create source git podinfo \ + --url=ssh://git@github.com/stefanprodan/podinfo \ + --branch=master \ + --private-key-file=./private.key \ + --password=<password> + # Create a source for a Git repository using basic authentication flux create source git podinfo \ --url=https://github.com/stefanprodan/podinfo \ diff --git a/docs/cmd/flux_create_secret_git.md b/docs/cmd/flux_create_secret_git.md index 042b39c2b7fc168d28b21f526d2e8d93a2393af5..2c47a213d2bb68aa4559783d3430dbd78d51ab73 100644 --- a/docs/cmd/flux_create_secret_git.md +++ b/docs/cmd/flux_create_secret_git.md @@ -31,6 +31,13 @@ flux create secret git [name] [flags] --url=ssh://git@github.com/stefanprodan/podinfo \ --private-key-file=./private.key + # Create a Git SSH authentication secret with a passworded private key from file + # The public SSH host key will still be gathered from the host + flux create secret git podinfo-auth \ + --url=ssh://git@github.com/stefanprodan/podinfo \ + --private-key-file=./private.key \ + --password=<password> + # Create a secret for a Git repository using basic authentication flux create secret git podinfo-auth \ --url=https://github.com/stefanprodan/podinfo \ diff --git a/docs/cmd/flux_create_source_git.md b/docs/cmd/flux_create_source_git.md index 6d6daf2332630db267f1d000fc8ed809fdd1ac93..70bbfca74f36f40bec20bb98cabcb1006b8f6a94 100644 --- a/docs/cmd/flux_create_source_git.md +++ b/docs/cmd/flux_create_source_git.md @@ -54,6 +54,15 @@ flux create source git [name] [flags] --branch=master \ --private-key-file=./private.key + # Create a source for a Git repository using SSH authentication and a + # private key with a password from file + # The public SSH host key will still be gathered from the host + flux create source git podinfo \ + --url=ssh://git@github.com/stefanprodan/podinfo \ + --branch=master \ + --private-key-file=./private.key \ + --password=<password> + # Create a source for a Git repository using basic authentication flux create source git podinfo \ --url=https://github.com/stefanprodan/podinfo \