浏览代码

[docker] git user id should be changeable

cgars 7 年之前
父节点
当前提交
0e12974861
共有 1 个文件被更改,包括 10 次插入0 次删除
  1. 10 0
      docker/start.sh

+ 10 - 0
docker/start.sh

@@ -53,6 +53,16 @@ ln -s /data/git/.ssh/authorized_keys /data/.ssh/authorized_keys
 # Backward Compatibility with Gogs Container v0.6.15
 # Backward Compatibility with Gogs Container v0.6.15
 ln -sf /data/git /home/git
 ln -sf /data/git /home/git
 
 
+# check whether we nedd to reset userid
+if [ ! -z "$GITUID" ]; then
+    echo "change git user id to $GITUID"
+    usermod -u "$GITUID" git
+fi
+if [ ! -z "$GITGID" ]; then
+    echo "change git group id to $GITGID"
+    groupmod -g "$GITGID" git
+fi
+
 chown -R git:git /data /app/gogs ~git/
 chown -R git:git /data /app/gogs ~git/
 chmod 0755 /data /data/gogs ~git/
 chmod 0755 /data /data/gogs ~git/