diff --git a/pkg/vendir/fetch/git/git.go b/pkg/vendir/fetch/git/git.go index 24bfd1e8..83bff865 100644 --- a/pkg/vendir/fetch/git/git.go +++ b/pkg/vendir/fetch/git/git.go @@ -93,7 +93,9 @@ func (t *Git) fetch(dstPath string, tempArea ctlfetch.TempArea) error { if authOpts.PrivateKey != nil { path := filepath.Join(authDir, "private-key") - err = os.WriteFile(path, []byte(*authOpts.PrivateKey), 0600) + // Adding newlinne as git does not support private-key without newline as last character. + // Now vendir will work with both with/without newline in private-key. + err = os.WriteFile(path, []byte(*authOpts.PrivateKey+"\n"), 0600) if err != nil { return fmt.Errorf("Writing private key: %s", err) }