Capture Neko/WG/network hubs, Studio viewer charts, physical deploy docs, and one-shot scripts so VPS vs physical can be toggled later without losing WIP. Co-authored-by: Cursor <cursoragent@cursor.com>
28 lines
863 B
Python
28 lines
863 B
Python
import paramiko
|
|
|
|
HOST = "107.173.30.245"
|
|
USER = "root"
|
|
PASSWORD = "Xiao4669805"
|
|
REPO = "/opt/douyinWEB"
|
|
GIT_REMOTE = "https://eric:Xiao4669805@gitea.dsx2020.com/eric/douyinWEB.git"
|
|
|
|
c = paramiko.SSHClient()
|
|
c.set_missing_host_key_policy(paramiko.AutoAddPolicy())
|
|
c.connect(HOST, 22, USER, PASSWORD, timeout=30, allow_agent=False, look_for_keys=False)
|
|
|
|
cmds = [
|
|
# make sure remote has credentials
|
|
(f"cd {REPO} && git remote set-url origin {GIT_REMOTE}", 30),
|
|
# create dev from current HEAD and push
|
|
(f"cd {REPO} && git checkout -B dev && git push -u origin dev 2>&1", 60),
|
|
(f"cd {REPO} && git branch --show-current", 15),
|
|
]
|
|
|
|
for cmd, timeout in cmds:
|
|
_s, out, err = c.exec_command(cmd, timeout=timeout)
|
|
o = out.read().decode("utf-8", "replace").strip()
|
|
e = err.read().decode("utf-8", "replace").strip()
|
|
print(o or e)
|
|
|
|
c.close()
|