Hey team, is it possible to use a Deploy Key inste...
# ask-community
z
Hey team, is it possible to use a Deploy Key instead of a PAT for authentication when using GitHub Storage?
d
Hi @Zach Hodowanec, I don’t believe GitHub storage supports using Deploy Keys at the moment, but we’d welcome a contribution or an issue on the
prefect
repo!
k
Yep, going further - Prefect’s GitHub Storage uses the PyGithub library which currently doesn’t support Deploy Keys, so a contribution there would be doubly effective.
👍 1
z
Ok, thank you both for the help!
r
it does, it is mainly the documentation is wrong in many places.
you can mod the prefect task (I have my own sorry, as my deploy key comes from vault)
Copy code
vault_client = load_vault.VaultReader(opts.stage, <http://opts.org|opts.org>, opts)
        keys = vault_client.read_secret_set('prefect/static_assets')

        key_file = tempfile.NamedTemporaryFile(mode='w')
        key_file.write(keys['jet-scripts.priv'])
        key_file.flush()
        os.chmod(key_file.name, 0o600)
        clone_dir = tempfile.TemporaryDirectory()
        self.tmp_dirs.append(clone_dir)  # Save in a list to keep the directory around for the life of the flow
        # Clone into temporary dir
        git_command = f"ssh -o StrictHostKeyChecking=no -i {key_file.name} "
        Repo.clone_from(self.repo, clone_dir.name, branch='master', depth=1,
                        env={'GIT_SSH_COMMAND': git_command})

        fnames = glob.glob(clone_dir.name + subdir + '/*')
the documentation for pygit, not prefect.
z
@Rob Fowler I'm not sure if I follow your example. Are you suggesting I change my prefect task or the prefect team update their GitHub storage task?
r
You could ask the upstream team to make a change for deployment keys or copy the file and use it locally, which is pretty easy. Deploy keys are the goto for data storage on github for me.
z
@Dylan @Kyle Moon-Wright do you have any thoughts on @Rob Fowler’s suggestion?
d
@Zach Hodowanec It certainly sounds like a straightforward workaround, depending on your setup
z
I was more so referring to y'all making the change for the rest of the community to benefit from
d
Opening an issue now 😉
z
Thanks Dylan!
👍 1