summaryrefslogtreecommitdiff
path: root/doc/setup-guide.md
diff options
context:
space:
mode:
Diffstat (limited to 'doc/setup-guide.md')
-rw-r--r--doc/setup-guide.md41
1 files changed, 21 insertions, 20 deletions
diff --git a/doc/setup-guide.md b/doc/setup-guide.md
index b8fcef3..e69ddf0 100644
--- a/doc/setup-guide.md
+++ b/doc/setup-guide.md
@@ -102,48 +102,49 @@ docker compose -f server.yaml up -d
### 4.3 Create a test repository
+Use `git-server/create-repo.sh` from the bastion repo root (run on the
+server, not inside the container). It runs `git init --bare` as the `git`
+user inside the running `git-server` container, so ownership and
+permissions come out correct without manual `chown`:
+
```bash
-# On the server
-cd /var/git/repos
-git init --bare test.git
-chown -R 1000:1000 test.git # git user inside container
+./git-server/create-repo.sh test
+```
+```bash
# From a client machine
git clone ssh://git@<server-ip>/repos/test.git
or
git clone git://<server-ip>/test.git
```
+Optionally pass a description: `./git-server/create-repo.sh test "my test repo"`.
+Repo names can include subdirectories, e.g. `team/project`.
+
### 4.4 Import an existing repository
-To make a one-time copy of an existing repository (e.g., from GitHub):
+Use `git-server/import-repo.sh` to mirror an existing repository (e.g. from
+GitHub or GitLab) into the server:
```bash
-cd /var/git/repos
-git clone --bare https://github.com/user/repo.git
-chown -R 1000:1000 repo.git
+./git-server/import-repo.sh https://github.com/user/repo.git
```
-This copies all branches, tags, and history. The remote reference is removed,
-so it becomes a standalone copy with no link back to the original.
-
-To keep syncing from the original source, use `--mirror` instead:
+This runs `git clone --mirror` as the `git` user inside the `git-server`
+container, straight into `/repos/repo.git`. By default the local repo name
+is taken from the source URL; pass a second argument to override it:
```bash
-cd /var/git/repos
-git clone --mirror https://github.com/user/repo.git
-chown -R 1000:1000 repo.git
+./git-server/import-repo.sh https://github.com/user/repo.git my-name
```
-This keeps the remote configured so you can periodically pull updates:
+`--mirror` is a one-time snapshot that keeps the remote configured, so you
+can pull in upstream changes later:
```bash
-cd /var/git/repos/repo.git
-git remote update
+docker exec -u git git-server git --git-dir='/repos/repo.git' remote update --prune
```
-`--mirror` syncs all refs exactly, including deleted branches.
-
## 5. Ghost (Blog)