Spaces:
Running
Running
openhands
commited on
Commit
·
671ebc9
1
Parent(s):
2176460
Fix git clone hanging issue - prevent credential prompts
Browse files- Add GIT_TERMINAL_PROMPT=0 to prevent git from prompting for credentials
- Add stdin=subprocess.DEVNULL to block any input requests
- Reduce timeout from 60s to 30s for faster failover
- This fixes the app hanging on 'Loading...' when GitHub repo is empty
- setup_data.py +7 -1
setup_data.py
CHANGED
|
@@ -25,12 +25,18 @@ def fetch_data_from_github():
|
|
| 25 |
|
| 26 |
print(f"Attempting to clone data from {GITHUB_REPO}...")
|
| 27 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 28 |
# Clone the repository
|
| 29 |
result = subprocess.run(
|
| 30 |
["git", "clone", "--depth", "1", GITHUB_REPO, str(temp_clone_dir)],
|
| 31 |
capture_output=True,
|
| 32 |
text=True,
|
| 33 |
-
timeout=
|
|
|
|
|
|
|
| 34 |
)
|
| 35 |
|
| 36 |
if result.returncode != 0:
|
|
|
|
| 25 |
|
| 26 |
print(f"Attempting to clone data from {GITHUB_REPO}...")
|
| 27 |
|
| 28 |
+
# Set environment to prevent git from prompting for credentials
|
| 29 |
+
env = os.environ.copy()
|
| 30 |
+
env['GIT_TERMINAL_PROMPT'] = '0'
|
| 31 |
+
|
| 32 |
# Clone the repository
|
| 33 |
result = subprocess.run(
|
| 34 |
["git", "clone", "--depth", "1", GITHUB_REPO, str(temp_clone_dir)],
|
| 35 |
capture_output=True,
|
| 36 |
text=True,
|
| 37 |
+
timeout=30, # Shorter timeout
|
| 38 |
+
stdin=subprocess.DEVNULL, # Prevent any input prompts
|
| 39 |
+
env=env # Use modified environment
|
| 40 |
)
|
| 41 |
|
| 42 |
if result.returncode != 0:
|