Update app.py
Browse files
app.py
CHANGED
@@ -16,11 +16,13 @@ def fetch_github_file(github_url, ssh_private_key):
|
|
16 |
ssh = paramiko.SSHClient()
|
17 |
ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())
|
18 |
|
19 |
-
#
|
20 |
-
|
21 |
-
|
|
|
|
|
22 |
# Load the private key
|
23 |
-
private_key = paramiko.RSAKey.from_private_key(io.StringIO(
|
24 |
|
25 |
# Connect to GitHub using SSH
|
26 |
ssh.connect('github.com', username='git', pkey=private_key)
|
|
|
16 |
ssh = paramiko.SSHClient()
|
17 |
ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())
|
18 |
|
19 |
+
# Format the SSH key
|
20 |
+
formatted_key = "-----BEGIN OPENSSH PRIVATE KEY-----\n"
|
21 |
+
formatted_key += "\n".join(ssh_private_key.strip().split())
|
22 |
+
formatted_key += "\n-----END OPENSSH PRIVATE KEY-----\n"
|
23 |
+
|
24 |
# Load the private key
|
25 |
+
private_key = paramiko.RSAKey.from_private_key(io.StringIO(formatted_key))
|
26 |
|
27 |
# Connect to GitHub using SSH
|
28 |
ssh.connect('github.com', username='git', pkey=private_key)
|