Files
workspace/try_create_repo_simple.py
aitest 15c4480db1 Add OpenClaw workspace configuration and tools
- Add agent configuration files (AGENTS.md, USER.md, IDENTITY.md, SOUL.md)
- Add git configuration and skills management scripts
- Add frontend/backend analysis tools and reports
- Add DingTalk media sender utilities and documentation
- Fix OpenClaw runtime environment (Node.js and Python)
- Configure git remotes and push scripts
2026-03-05 13:56:59 +09:00

54 lines
1.8 KiB
Python

#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""Try to create remote repository"""
import subprocess
import sys
# Git configuration
GIT_SERVER = "git.alicorns.co.jp"
GIT_USER = "aitest"
REPONAME = "office-file-handler"
print("=== Try to create remote repository ===")
print("Git server:", GIT_SERVER)
print("User:", GIT_USER)
print("Repository:", REPONAME)
print()
# Method 1: Try SSH to create bare repository
print("Method 1: SSH to create bare repository")
ssh_command = f'ssh -o StrictHostKeyChecking=no -o ConnectTimeout=10 {GIT_USER}@{GIT_SERVER} "mkdir -p /git/{REPONAME}.git && cd /git/{REPONAME}.git && git init --bare"'
print("Command:", ssh_command)
try:
result = subprocess.run(ssh_command, shell=True, capture_output=True, text=True, timeout=30)
print("Output:", result.stdout)
print("Error:", result.stderr)
if result.returncode == 0:
print("SUCCESS: SSH creation worked!")
else:
print("FAILED: SSH creation failed, return code:", result.returncode)
except subprocess.TimeoutExpired:
print("FAILED: SSH connection timeout")
except Exception as e:
print("FAILED: SSH error:", e)
print()
# Method 2: Check git server info
print("Method 2: Check git server info")
try:
result = subprocess.run(["git", "ls-remote", f"https://{GIT_USER}@{GIT_SERVER}/"],
capture_output=True, text=True, timeout=10)
print("ls-remote output:", result.stdout[:200] if result.stdout else "empty")
print("ls-remote error:", result.stderr[:200] if result.stderr else "empty")
except Exception as e:
print("FAILED: ls-remote error:", e)
print()
print("If automatic creation fails, please create repository manually:")
print("1. Visit https://" + GIT_SERVER + "/")
print("2. Create repository: " + REPONAME)
print("3. Then use git push to upload code")