Set ssh keys manually on git
Signed-off-by: baalajimaestro <me@baalajimaestro.me>
This commit is contained in:
parent
0bacbf7241
commit
415d1a8a2f
1 changed files with 5 additions and 2 deletions
|
@ -31,6 +31,9 @@ BLACKLIST = [
|
||||||
enc_path = os.environ.get("ENCRYPTED_PATH")
|
enc_path = os.environ.get("ENCRYPTED_PATH")
|
||||||
enc_repo = os.environ.get("ENCRYPTED_REPO")
|
enc_repo = os.environ.get("ENCRYPTED_REPO")
|
||||||
enc_key = os.environ.get("ENCRYPTION_KEY")
|
enc_key = os.environ.get("ENCRYPTION_KEY")
|
||||||
|
ssh_key = os.environ.get("SSH_SECRET_KEY")
|
||||||
|
|
||||||
|
git_ssh_cmd = f"ssh -o StrictHostKeyChecking=no -i {ssh_key}"
|
||||||
|
|
||||||
# Create our encrypted directory base
|
# Create our encrypted directory base
|
||||||
current_time = str(int(time()))
|
current_time = str(int(time()))
|
||||||
|
@ -43,7 +46,7 @@ os.chdir(enc_path)
|
||||||
repo = Repo.init(enc_path)
|
repo = Repo.init(enc_path)
|
||||||
repo.create_remote(
|
repo.create_remote(
|
||||||
"origin",
|
"origin",
|
||||||
f"git@github.com:{enc_repo}.git",
|
f"ssh://git@github.com/{enc_repo}.git",
|
||||||
)
|
)
|
||||||
|
|
||||||
# Glob the file list of "." starting files and non "." starting files
|
# Glob the file list of "." starting files and non "." starting files
|
||||||
|
@ -92,7 +95,7 @@ for i in file_list:
|
||||||
# Add, commit and push it all
|
# Add, commit and push it all
|
||||||
repo.git.add(".")
|
repo.git.add(".")
|
||||||
repo.index.commit(f"Commit as of {current_time}")
|
repo.index.commit(f"Commit as of {current_time}")
|
||||||
repo.git.push("origin", "master", force=True)
|
repo.git.push("origin", "master", force=True, env=dict(GIT_SSH_COMMAND=git_ssh_cmd))
|
||||||
|
|
||||||
# Cleanup once you are done
|
# Cleanup once you are done
|
||||||
rmtree(enc_path)
|
rmtree(enc_path)
|
||||||
|
|
Loading…
Reference in a new issue