Fix git safe.directory for mounted /repo in Docker
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -20,6 +20,9 @@ RUN mkdir -p /app/uploads && adduser --disabled-password --gecos "" appuser \
|
|||||||
USER appuser
|
USER appuser
|
||||||
|
|
||||||
ENV FLASK_APP=wsgi:app
|
ENV FLASK_APP=wsgi:app
|
||||||
|
ENV GIT_CONFIG_COUNT=1
|
||||||
|
ENV GIT_CONFIG_KEY_0=safe.directory
|
||||||
|
ENV GIT_CONFIG_VALUE_0=/repo
|
||||||
|
|
||||||
EXPOSE 8000
|
EXPOSE 8000
|
||||||
|
|
||||||
|
|||||||
+2
-1
@@ -26,8 +26,9 @@ def run_git(args, timeout=120):
|
|||||||
if not _repo_ready():
|
if not _repo_ready():
|
||||||
return False, f"Git-репозиторий не найден: {get_repo_path()}"
|
return False, f"Git-репозиторий не найден: {get_repo_path()}"
|
||||||
|
|
||||||
|
repo = get_repo_path()
|
||||||
result = subprocess.run(
|
result = subprocess.run(
|
||||||
["git", "-C", get_repo_path()] + args,
|
["git", "-c", f"safe.directory={repo}", "-C", repo] + args,
|
||||||
capture_output=True,
|
capture_output=True,
|
||||||
text=True,
|
text=True,
|
||||||
timeout=timeout,
|
timeout=timeout,
|
||||||
|
|||||||
@@ -33,6 +33,9 @@ services:
|
|||||||
GIT_REPO_PATH: /repo
|
GIT_REPO_PATH: /repo
|
||||||
GIT_REMOTE_URL: ${GIT_REMOTE_URL:-https://git.evilfox.cc/test2/fotohost.git}
|
GIT_REMOTE_URL: ${GIT_REMOTE_URL:-https://git.evilfox.cc/test2/fotohost.git}
|
||||||
ALLOW_GIT_DEPLOY: ${ALLOW_GIT_DEPLOY:-false}
|
ALLOW_GIT_DEPLOY: ${ALLOW_GIT_DEPLOY:-false}
|
||||||
|
GIT_CONFIG_COUNT: "1"
|
||||||
|
GIT_CONFIG_KEY_0: safe.directory
|
||||||
|
GIT_CONFIG_VALUE_0: /repo
|
||||||
volumes:
|
volumes:
|
||||||
- uploads_data:/app/uploads
|
- uploads_data:/app/uploads
|
||||||
- .:/repo
|
- .:/repo
|
||||||
|
|||||||
Reference in New Issue
Block a user