Skip to content

Commit 8bb5282

Browse files
committed
docs: reorganize SSH documentation for better user experience
1 parent c2cd33e commit 8bb5282

3 files changed

Lines changed: 287 additions & 80 deletions

File tree

README.md

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -68,11 +68,10 @@ $ npx -- @finos/git-proxy
6868

6969
Clone a repository, set the remote to the GitProxy URL and push your changes:
7070

71+
### Using HTTPS
72+
7173
```bash
72-
# Both HTTPS and SSH cloning are supported
7374
$ git clone https://github.com/octocat/Hello-World.git && cd Hello-World
74-
# Or use SSH:
75-
# $ git clone git@github.com:octocat/Hello-World.git && cd Hello-World
7675
# The below command is using the GitHub official CLI to fork the repo that is cloned.
7776
# You can also fork on the GitHub UI. For usage details on the CLI, see https://github.com/cli/cli
7877
$ gh repo fork
@@ -83,6 +82,25 @@ $ git remote add proxy http://localhost:8000/yourGithubUser/Hello-World.git
8382
$ git push proxy $(git symbolic-ref refs/remotes/origin/HEAD | sed 's@^refs/remotes/origin/@@')
8483
```
8584

85+
### Using SSH
86+
87+
```bash
88+
$ git clone https://github.com/octocat/Hello-World.git && cd Hello-World
89+
$ gh repo fork
90+
✓ Created fork yourGithubUser/Hello-World
91+
...
92+
# Configure Git remote for SSH proxy
93+
$ git remote add proxy ssh://git@localhost:2222/github.com/yourGithubUser/Hello-World.git
94+
# Enable SSH agent forwarding (required)
95+
$ git config core.sshCommand "ssh -A"
96+
# Push through the proxy
97+
$ git push proxy $(git symbolic-ref refs/remotes/origin/HEAD | sed 's@^refs/remotes/origin/@@')
98+
```
99+
100+
📖 **Full SSH setup guide**: [docs/SSH_SETUP.md](docs/SSH_SETUP.md)
101+
102+
---
103+
86104
Using the default configuration, GitProxy intercepts the push and _blocks_ it. To enable code pushing to your fork via GitProxy, add your repository URL into the GitProxy config file (`proxy.config.json`). For more information, refer to [our documentation](https://git-proxy.finos.org).
87105

88106
## Protocol Support

docs/SSH_ARCHITECTURE.md

Lines changed: 13 additions & 77 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,12 @@
11
# SSH Proxy Architecture
22

3-
Complete documentation of the SSH proxy architecture and operation for Git.
3+
Internal architecture and technical implementation details of the SSH proxy for Git.
44

5-
### Main Components
5+
**For user setup instructions**, see [SSH_SETUP.md](SSH_SETUP.md)
6+
7+
---
8+
9+
## Main Components
610

711
```
812
┌─────────────┐ ┌──────────────────┐ ┌──────────┐
@@ -22,14 +26,19 @@ Complete documentation of the SSH proxy architecture and operation for Git.
2226

2327
The **SSH host key** is the proxy server's cryptographic identity. It identifies the proxy to clients and prevents man-in-the-middle attacks.
2428

25-
**Auto-generated**: On first startup, git-proxy generates an Ed25519 host key stored in `.ssh/host_key` and `.ssh/host_key.pub`.
29+
**Auto-generated**: On first startup, git-proxy generates an Ed25519 host key:
30+
31+
- Private key: `.ssh/proxy_host_key`
32+
- Public key: `.ssh/proxy_host_key.pub`
33+
34+
These paths are relative to the directory where git-proxy is running (the `WorkingDirectory` in systemd or the container's working directory in Docker).
2635

2736
**Important**: The host key is NOT used for authenticating to GitHub/GitLab. Agent forwarding handles remote authentication using the client's keys.
2837

2938
**First connection warning**:
3039

3140
```
32-
The authenticity of host '[localhost]:2222' can't be established.
41+
The authenticity of host '[git-proxy.example.com]:2222' can't be established.
3342
ED25519 key fingerprint is SHA256:xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx.
3443
Are you sure you want to continue connecting (yes/no)?
3544
```
@@ -38,79 +47,6 @@ This is normal! If it appears on subsequent connections, it could indicate the p
3847

3948
---
4049

41-
## Client → Proxy Communication
42-
43-
### Client Setup
44-
45-
**1. Configure Git remote**:
46-
47-
```bash
48-
# For GitHub
49-
git remote add origin ssh://git@git-proxy.example.com:2222/github.com/org/repo.git
50-
51-
# For GitLab
52-
git remote add origin ssh://git@git-proxy.example.com:2222/gitlab.com/org/repo.git
53-
```
54-
55-
> **⚠️ Important:** The repository URL must end with `.git` or the SSH server will reject it.
56-
57-
**2. Generate SSH key (if not already present)**:
58-
59-
```bash
60-
# Check if you already have an SSH key
61-
ls -la ~/.ssh/id_*.pub
62-
63-
# If no key exists, generate a new Ed25519 key
64-
ssh-keygen -t ed25519 -C "your_email@example.com"
65-
# Press Enter to accept default location (~/.ssh/id_ed25519)
66-
# Optionally set a passphrase for extra security
67-
```
68-
69-
**3. Start ssh-agent and load key**:
70-
71-
```bash
72-
eval $(ssh-agent -s)
73-
ssh-add ~/.ssh/id_ed25519
74-
ssh-add -l # Verify key loaded
75-
```
76-
77-
**⚠️ Important: ssh-agent is per-terminal session**
78-
79-
**4. Register public key with proxy**:
80-
81-
```bash
82-
cat ~/.ssh/id_ed25519.pub
83-
# Register via UI (http://localhost:8000) or database
84-
```
85-
86-
**5. Configure SSH agent forwarding**:
87-
88-
⚠️ **Security Note**: Choose the most appropriate method for your security requirements.
89-
90-
**Option A: Per-repository (RECOMMENDED)**
91-
92-
```bash
93-
# For existing repositories
94-
cd /path/to/your/repo
95-
git config core.sshCommand "ssh -A"
96-
97-
# For cloning new repositories
98-
git clone -c core.sshCommand="ssh -A" ssh://git@git-proxy.example.com:2222/github.com/org/repo.git
99-
```
100-
101-
**Option B: Per-host via SSH config**
102-
103-
```
104-
Host git-proxy.example.com
105-
ForwardAgent yes
106-
IdentityFile ~/.ssh/id_ed25519
107-
Port 2222
108-
```
109-
110-
**Custom Error Messages**: Administrators can customize the agent forwarding error message via `ssh.agentForwardingErrorMessage` in the proxy configuration.
111-
112-
---
113-
11450
## SSH Agent Forwarding
11551

11652
SSH agent forwarding allows the proxy to use the client's SSH keys **without ever receiving them**. The private key remains on the client's computer.

0 commit comments

Comments
 (0)