Skip to content

Commit 28be245

Browse files
authored
Merge pull request #181 from ByteInternet/Create-.ssh-folder-in-home-directory-when-it-doesnt-exist-as-fallback-import-ssh
Create .ssh folder in home-directory when it doesnt exist as fallback import ssh
2 parents f8e995c + 995a569 commit 28be245

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/Deployer/Task/Common/PrepareSshTaskGlobal.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,11 @@ public function configure(Configuration $config): void
3434
}
3535
}
3636

37-
return '~/.ssh/id_rsa'; // Fallback
37+
$home = getenv('HOME');
38+
if (!is_dir($home . '/.ssh')) {
39+
mkdir($home . '/.ssh', 0700, true);
40+
}
41+
return $home . '/.ssh/id_rsa'; // Fallback
3842
});
3943

4044
task('prepare:ssh', function () {

0 commit comments

Comments
 (0)