39 lines
1.3 KiB
Python
39 lines
1.3 KiB
Python
import subprocess
|
|
|
|
project_name = input("Geben Sie den Projektnamen ein: ")
|
|
hostname = "192.168.2.106"
|
|
username = "yannick"
|
|
port = "22" # Anpassen, falls ein anderer Port verwendet wird
|
|
|
|
# Befehle für die SSH-Verbindung
|
|
commands = [
|
|
"cd ..",
|
|
"cd ..",
|
|
"cd ..",
|
|
f"cd share/Public/git",
|
|
f"mkdir {project_name}.git",
|
|
f"mkdir {project_name}",
|
|
f"cd {project_name}.git",
|
|
"git init --bare",
|
|
"cd ../",
|
|
f"cd {project_name}",
|
|
"git init",
|
|
'git config --global user.email "y-esser@t-online.de"',
|
|
'git config --global user.name "Yannick"',
|
|
"touch README.txt",
|
|
"git add .",
|
|
'git commit -am "INIT"',
|
|
f"git remote add origin ssh://{username}@{hostname}/share/Public/git/{project_name}.git"
|
|
]
|
|
|
|
# SSH-Verbindung herstellen und Befehle ausführen
|
|
command_string = " && ".join(commands)
|
|
subprocess.run(["ssh", "-p", port, f"{username}@{hostname}", command_string])
|
|
print("Bitte gehe selber per ssh auf das nas um ein >git push origin master< zu machen um das vollständig ab zu schließen")
|
|
print(f"cdshare/Public/git/{project_name}")
|
|
print("git push origin master")
|
|
print(f'git clone "ssh://yannick@192.168.2.106/share/Public/git/{project_name}.git"')
|
|
|
|
# Temporäre Datei entfernen (nicht erforderlich, da direkt übergeben)
|
|
# subprocess.run(["del", "commands.sh"], shell=True)
|