#!/usr/bin/env python import os import sys import subprocess import config keys = subprocess.check_output(["ssh", "git@{}".format(config.GITLAB_HOST), "-p", "{}".format(config.GITLAB_SSH_PORT), "cat", ".ssh/authorized_keys"]) with open("/home/git/.ssh/authorized_keys", "w") as ak: ak.write(keys)