Skip to content

Commit

Permalink
PrivateKey with or without extra char as newline will be accepted by …
Browse files Browse the repository at this point in the history
…vendir

Signed-off-by: kumari tanushree <[email protected]>
  • Loading branch information
kumari tanushree committed Jan 9, 2024
1 parent 0b54783 commit eea3965
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion pkg/vendir/fetch/git/git.go
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,8 @@ 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)
// Ensure the private key ends with a newline character, as git requires it to work. (https://github.com/carvel-dev/vendir/issues/350)
err = os.WriteFile(path, []byte(*authOpts.PrivateKey+"\n"), 0600)
if err != nil {
return fmt.Errorf("Writing private key: %s", err)
}
Expand Down

0 comments on commit eea3965

Please sign in to comment.