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 8, 2024
1 parent 0b54783 commit 258fccc
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion pkg/vendir/fetch/git/git.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand Down

0 comments on commit 258fccc

Please sign in to comment.