Handle existing .ssh dir on merger

The recent change to automatically add host keys to known_hosts
in the merger always attempts to create the .ssh directory.  This
error is not fatal, but it emits error messages and prevents
keys from being added in some cases.

Make it a noop if the dir exists.

Change-Id: Ibb76b336de6774dc1516fb2890fe3afcb7ed36df
This commit is contained in:
James E. Blair 2018-11-14 15:30:33 +01:00
parent 71f60674b9
commit dd218b6700
1 changed files with 1 additions and 1 deletions

View File

@ -115,7 +115,7 @@ class Repo(object):
username = url.username or self.username
path = os.path.expanduser('~/.ssh')
os.makedirs(path)
os.makedirs(path, exist_ok=True)
path = os.path.expanduser('~/.ssh/known_hosts')
if not os.path.exists(path):
with open(path, 'w'):