Skip to content

Commit

Permalink
Merge pull request #349 from carvel-dev/enhance-sshKey-acceptance
Browse files Browse the repository at this point in the history
PrivateKey with or without extra char as newline will be accepted
  • Loading branch information
joaopapereira authored Jan 9, 2024
2 parents 07c86f7 + eea3965 commit e4babdd
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 e4babdd

Please sign in to comment.