Only read ssh public key if file exists

(cherry picked from commit 353ad5caf8d058a3ccd31edd306f3fbe08297953)