Skip to content

Commit

Permalink
fix: ensure generated SSH keys have no carriage returns
Browse files Browse the repository at this point in the history
  • Loading branch information
themightychris committed Dec 20, 2022
1 parent 773b381 commit 06275a7
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions php-classes/Emergence/Git/Source.php
Original file line number Diff line number Diff line change
Expand Up @@ -182,11 +182,11 @@ public function getDeployKey()
public function setDeployKey(KeyPair $keyPair)
{
$privateKeyPath = $this->getPrivateKeyPath();
file_put_contents($privateKeyPath, $keyPair->getPrivateKey().PHP_EOL);
file_put_contents($privateKeyPath, str_replace("\r\n", "\n", $keyPair->getPrivateKey()).PHP_EOL);
chmod($privateKeyPath, 0600);

$publicKeyPath = $this->getPublicKeyPath();
file_put_contents($publicKeyPath, $keyPair->getPublicKey().PHP_EOL);
file_put_contents($publicKeyPath, str_replace("\r\n", "\n", $keyPair->getPublicKey()).PHP_EOL);
chmod($publicKeyPath, 0600);

$this->deployKey = $keyPair;
Expand Down

0 comments on commit 06275a7

Please sign in to comment.