git-ssh-sync 0.1.0__tar.gz → 0.3.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {git_ssh_sync-0.1.0 → git_ssh_sync-0.3.0}/PKG-INFO +190 -1
- {git_ssh_sync-0.1.0 → git_ssh_sync-0.3.0}/README.md +189 -0
- {git_ssh_sync-0.1.0 → git_ssh_sync-0.3.0}/pyproject.toml +1 -1
- {git_ssh_sync-0.1.0 → git_ssh_sync-0.3.0}/src/git_ssh_sync/__init__.py +1 -1
- git_ssh_sync-0.3.0/src/git_ssh_sync/attach.py +486 -0
- {git_ssh_sync-0.1.0 → git_ssh_sync-0.3.0}/src/git_ssh_sync/branch.py +7 -1
- git_ssh_sync-0.3.0/src/git_ssh_sync/cli.py +590 -0
- {git_ssh_sync-0.1.0 → git_ssh_sync-0.3.0}/src/git_ssh_sync/clone.py +42 -21
- {git_ssh_sync-0.1.0 → git_ssh_sync-0.3.0}/src/git_ssh_sync/config.py +99 -1
- git_ssh_sync-0.3.0/src/git_ssh_sync/dev.py +110 -0
- {git_ssh_sync-0.1.0 → git_ssh_sync-0.3.0}/src/git_ssh_sync/doctor.py +291 -48
- {git_ssh_sync-0.1.0 → git_ssh_sync-0.3.0}/src/git_ssh_sync/git.py +15 -0
- git_ssh_sync-0.3.0/src/git_ssh_sync/logging_config.py +84 -0
- git_ssh_sync-0.3.0/src/git_ssh_sync/ssh.py +259 -0
- {git_ssh_sync-0.1.0 → git_ssh_sync-0.3.0}/src/git_ssh_sync/status.py +37 -14
- {git_ssh_sync-0.1.0 → git_ssh_sync-0.3.0}/src/git_ssh_sync/sync.py +164 -8
- git_ssh_sync-0.1.0/src/git_ssh_sync/cli.py +0 -228
- git_ssh_sync-0.1.0/src/git_ssh_sync/ssh.py +0 -55
- {git_ssh_sync-0.1.0 → git_ssh_sync-0.3.0}/src/git_ssh_sync/console.py +0 -0
- {git_ssh_sync-0.1.0 → git_ssh_sync-0.3.0}/src/git_ssh_sync/errors.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.3
|
|
2
2
|
Name: git-ssh-sync
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.3.0
|
|
4
4
|
Summary: Sync Git commits through a local machine for development environments without direct GitHub or GitLab access.
|
|
5
5
|
Requires-Dist: pydantic>=2.13.4
|
|
6
6
|
Requires-Dist: pyyaml>=6.0.3
|
|
@@ -21,6 +21,8 @@ Description-Content-Type: text/markdown
|
|
|
21
21
|
|
|
22
22
|
`git-ssh-sync` is a CLI tool for synchronizing Git commits created in a development environment that cannot directly access GitHub/GitLab to external Git services via a local machine.
|
|
23
23
|
|
|
24
|
+
This tool is designed for niche environments where outbound network access is restricted, such as high-security enterprises and projects that only allow limited inbound communication (e.g., SSH, RDP).
|
|
25
|
+
|
|
24
26
|
This is not a file synchronization tool. It synchronizes Git objects and branches. Source editing, building, testing, and committing are performed in the development environment, while communication with GitHub/GitLab is handled by the local machine.
|
|
25
27
|
|
|
26
28
|
## Prerequisites
|
|
@@ -88,8 +90,21 @@ Key parameters:
|
|
|
88
90
|
- `--origin`: Repository URL on the GitHub / GitLab side
|
|
89
91
|
- `--dev-host`: SSH host of the development environment
|
|
90
92
|
- `--dev-user`: SSH user of the development environment
|
|
93
|
+
- `--dev-os`: Development environment OS, either `posix` or `windows` (default: `posix`)
|
|
91
94
|
- `--dev-path`: Path to the work repository on the development environment
|
|
92
95
|
|
|
96
|
+
For a Windows development environment, specify `--dev-os windows` and use Windows
|
|
97
|
+
paths. Windows SSH commands are executed through PowerShell.
|
|
98
|
+
|
|
99
|
+
```powershell
|
|
100
|
+
git-ssh-sync init myproject `
|
|
101
|
+
--origin git@github.com:example/myproject.git `
|
|
102
|
+
--dev-host devserver `
|
|
103
|
+
--dev-user user `
|
|
104
|
+
--dev-os windows `
|
|
105
|
+
--dev-path C:\Users\user\work\myproject
|
|
106
|
+
```
|
|
107
|
+
|
|
93
108
|
For `--origin`, specify a remote URL that can be used with `git clone` or `git fetch`. Main formats are:
|
|
94
109
|
|
|
95
110
|
```text
|
|
@@ -113,6 +128,29 @@ git-ssh-sync init myproject \
|
|
|
113
128
|
--force
|
|
114
129
|
```
|
|
115
130
|
|
|
131
|
+
You can inspect and maintain registered projects without opening the config file directly.
|
|
132
|
+
|
|
133
|
+
```bash
|
|
134
|
+
# List registered projects
|
|
135
|
+
git-ssh-sync config list
|
|
136
|
+
|
|
137
|
+
# Show all settings for one project
|
|
138
|
+
git-ssh-sync config show myproject
|
|
139
|
+
|
|
140
|
+
# Update selected settings
|
|
141
|
+
git-ssh-sync config set myproject \
|
|
142
|
+
--origin git@github.com:example/myproject.git \
|
|
143
|
+
--dev-host devserver \
|
|
144
|
+
--dev-os posix \
|
|
145
|
+
--dev-path /home/user/work/myproject
|
|
146
|
+
|
|
147
|
+
# Remove a project after confirmation
|
|
148
|
+
git-ssh-sync config remove myproject
|
|
149
|
+
|
|
150
|
+
# Remove a project without an interactive prompt
|
|
151
|
+
git-ssh-sync config remove myproject --yes
|
|
152
|
+
```
|
|
153
|
+
|
|
116
154
|
## Initial Workflow
|
|
117
155
|
|
|
118
156
|
For the first time, execute configuration, clone to the development environment, and diagnostics in order.
|
|
@@ -137,6 +175,54 @@ Afterward, the work repository on the development environment can be used as a n
|
|
|
137
175
|
|
|
138
176
|
`doctor` checks the local environment, SSH connection, fetch/push permissions to origin, and repository deployment on the development environment. Run this not only for the first time but also when synchronization is not working properly.
|
|
139
177
|
|
|
178
|
+
## Attaching Existing Repositories
|
|
179
|
+
|
|
180
|
+
If the gateway repository, development work repository, or cache repository already
|
|
181
|
+
exists, use `attach` instead of `clone`.
|
|
182
|
+
|
|
183
|
+
```bash
|
|
184
|
+
git-ssh-sync init myproject \
|
|
185
|
+
--origin git@github.com:example/myproject.git \
|
|
186
|
+
--dev-host devserver \
|
|
187
|
+
--dev-user user \
|
|
188
|
+
--dev-path /home/user/work/myproject
|
|
189
|
+
git-ssh-sync attach myproject --dry-run
|
|
190
|
+
git-ssh-sync attach myproject
|
|
191
|
+
git-ssh-sync doctor myproject
|
|
192
|
+
```
|
|
193
|
+
|
|
194
|
+
`attach` inspects the configured origin URL, current branch, development work
|
|
195
|
+
tree state, bare cache repository, and `gitsync` remote. Before changing
|
|
196
|
+
anything, it prints the operations it will apply. Use `--yes` for non-interactive
|
|
197
|
+
execution after reviewing the plan.
|
|
198
|
+
|
|
199
|
+
```bash
|
|
200
|
+
git-ssh-sync attach myproject --yes
|
|
201
|
+
```
|
|
202
|
+
|
|
203
|
+
If only the `gitsync` remote or cache wiring is missing or mismatched, run
|
|
204
|
+
`doctor --repair` to inspect and repair it through the same preflight checks.
|
|
205
|
+
|
|
206
|
+
```bash
|
|
207
|
+
git-ssh-sync doctor myproject --repair
|
|
208
|
+
git-ssh-sync doctor myproject --repair --yes
|
|
209
|
+
```
|
|
210
|
+
|
|
211
|
+
After an interrupted `pull` or `push`, use `recover` as the recovery-oriented
|
|
212
|
+
entry point. Without `--yes`, it diagnoses origin, gateway, cache, and work
|
|
213
|
+
repository state and prints concrete next actions. With `--yes`, it applies only
|
|
214
|
+
safe wiring repairs such as creating the cache repository, seeding the cache
|
|
215
|
+
branch, or fixing the `gitsync` remote.
|
|
216
|
+
|
|
217
|
+
```bash
|
|
218
|
+
git-ssh-sync recover myproject
|
|
219
|
+
git-ssh-sync recover myproject --yes
|
|
220
|
+
```
|
|
221
|
+
|
|
222
|
+
`attach` and `doctor --repair` do not commit, stash, merge, or rebase existing
|
|
223
|
+
work. If the development work tree is dirty, or if a path is not a compatible Git
|
|
224
|
+
repository, the command stops and prints the manual recovery action.
|
|
225
|
+
|
|
140
226
|
## Daily Development Workflow
|
|
141
227
|
|
|
142
228
|
For daily development, `pull` from the local machine before starting work, commit normally in the development environment, and finally `push` from the local machine.
|
|
@@ -164,6 +250,13 @@ git-ssh-sync push myproject
|
|
|
164
250
|
|
|
165
251
|
`pull` and `push` target the current branch of the work repository on the development environment. To synchronize a different branch, switch the work repository branch with `checkout` first.
|
|
166
252
|
|
|
253
|
+
Use `--dry-run` to inspect the planned operations and preflight checks before changing refs:
|
|
254
|
+
|
|
255
|
+
```bash
|
|
256
|
+
git-ssh-sync pull myproject --dry-run
|
|
257
|
+
git-ssh-sync push myproject --dry-run
|
|
258
|
+
```
|
|
259
|
+
|
|
167
260
|
## Branch Switching Workflow
|
|
168
261
|
|
|
169
262
|
To switch to an existing branch, execute `checkout` from the local machine.
|
|
@@ -180,6 +273,13 @@ To create a new branch, use `-b`. Use `--base` together to explicitly specify th
|
|
|
180
273
|
git-ssh-sync checkout myproject -b feature/foo --base develop
|
|
181
274
|
```
|
|
182
275
|
|
|
276
|
+
To preview a branch switch or branch creation without changing origin, cache, or work repo refs:
|
|
277
|
+
|
|
278
|
+
```bash
|
|
279
|
+
git-ssh-sync checkout myproject feature/foo --dry-run
|
|
280
|
+
git-ssh-sync checkout myproject -b feature/foo --base develop --dry-run
|
|
281
|
+
```
|
|
282
|
+
|
|
183
283
|
Development environment:
|
|
184
284
|
|
|
185
285
|
```bash
|
|
@@ -213,6 +313,20 @@ To list existence status and ahead/behind for each branch, use `branch`.
|
|
|
213
313
|
git-ssh-sync branch myproject
|
|
214
314
|
```
|
|
215
315
|
|
|
316
|
+
To inspect the development work repo directly from the local machine, use the
|
|
317
|
+
read-only `dev` commands.
|
|
318
|
+
|
|
319
|
+
```bash
|
|
320
|
+
git-ssh-sync dev status myproject
|
|
321
|
+
git-ssh-sync dev diff myproject
|
|
322
|
+
git-ssh-sync dev diff myproject --stat
|
|
323
|
+
git-ssh-sync dev log myproject --max-count 5
|
|
324
|
+
```
|
|
325
|
+
|
|
326
|
+
These commands run `git status`, `git diff`, or `git log` on the development
|
|
327
|
+
work repo over SSH. They do not update origin, the local gateway repo, the
|
|
328
|
+
development cache repo, or the development work repo refs.
|
|
329
|
+
|
|
216
330
|
## Operational Rules
|
|
217
331
|
|
|
218
332
|
When using `git-ssh-sync`, following these rules makes it easier to understand the state:
|
|
@@ -244,6 +358,12 @@ git-ssh-sync init myproject \
|
|
|
244
358
|
--dev-user user \
|
|
245
359
|
--dev-path /home/user/work/myproject
|
|
246
360
|
|
|
361
|
+
# List registered project settings
|
|
362
|
+
git-ssh-sync config list
|
|
363
|
+
|
|
364
|
+
# Show registered project settings
|
|
365
|
+
git-ssh-sync config show myproject
|
|
366
|
+
|
|
247
367
|
# Initial clone
|
|
248
368
|
git-ssh-sync clone myproject
|
|
249
369
|
|
|
@@ -253,6 +373,12 @@ git-ssh-sync status myproject
|
|
|
253
373
|
# Check branch status
|
|
254
374
|
git-ssh-sync branch myproject
|
|
255
375
|
|
|
376
|
+
# Inspect development work repo status
|
|
377
|
+
git-ssh-sync dev status myproject
|
|
378
|
+
|
|
379
|
+
# Inspect development work repo diff
|
|
380
|
+
git-ssh-sync dev diff myproject --stat
|
|
381
|
+
|
|
256
382
|
# Reflect changes from origin to development environment
|
|
257
383
|
git-ssh-sync pull myproject
|
|
258
384
|
|
|
@@ -267,8 +393,61 @@ git-ssh-sync checkout myproject -b feature/foo --base develop
|
|
|
267
393
|
|
|
268
394
|
# Diagnostics
|
|
269
395
|
git-ssh-sync doctor myproject
|
|
396
|
+
|
|
397
|
+
# Diagnose and optionally repair after an interrupted sync
|
|
398
|
+
git-ssh-sync recover myproject
|
|
399
|
+
git-ssh-sync recover myproject --yes
|
|
400
|
+
```
|
|
401
|
+
|
|
402
|
+
## Logging
|
|
403
|
+
|
|
404
|
+
`git-ssh-sync` supports detailed logging for troubleshooting and monitoring synchronization operations.
|
|
405
|
+
|
|
406
|
+
### Log Levels
|
|
407
|
+
|
|
408
|
+
By default, only warnings and errors are displayed. You can increase verbosity using the following options:
|
|
409
|
+
|
|
410
|
+
- `--verbose`, `-v`: Enable INFO level logging (operation progress, Git/SSH commands)
|
|
411
|
+
- `--debug`, `-d`: Enable DEBUG level logging (all debug information, command output, stack traces)
|
|
412
|
+
|
|
413
|
+
### Log File Output
|
|
414
|
+
|
|
415
|
+
Logs are automatically saved to `~/.cache/git-ssh-sync/logs/git-ssh-sync.log`. The log file contains all log levels (DEBUG and above) regardless of console output settings.
|
|
416
|
+
|
|
417
|
+
You can specify a custom log file path using `--log-file`:
|
|
418
|
+
|
|
419
|
+
```bash
|
|
420
|
+
git-ssh-sync pull myproject --log-file /tmp/my-sync.log
|
|
270
421
|
```
|
|
271
422
|
|
|
423
|
+
### Usage Examples
|
|
424
|
+
|
|
425
|
+
```bash
|
|
426
|
+
# Default (warnings and errors only)
|
|
427
|
+
git-ssh-sync pull myproject
|
|
428
|
+
|
|
429
|
+
# Verbose output (operation progress)
|
|
430
|
+
git-ssh-sync pull myproject --verbose
|
|
431
|
+
|
|
432
|
+
# Debug output (all details including command execution)
|
|
433
|
+
git-ssh-sync pull myproject --debug
|
|
434
|
+
|
|
435
|
+
# Verbose with custom log file
|
|
436
|
+
git-ssh-sync push myproject --verbose --log-file /tmp/sync.log
|
|
437
|
+
|
|
438
|
+
# Debug output for diagnostics
|
|
439
|
+
git-ssh-sync doctor myproject --debug
|
|
440
|
+
```
|
|
441
|
+
|
|
442
|
+
### Log Content
|
|
443
|
+
|
|
444
|
+
- **INFO**: Operation progress (pull/push/checkout), success messages
|
|
445
|
+
- **DEBUG**: Git/SSH commands executed, return codes, stdout/stderr, working directories
|
|
446
|
+
- **WARNING**: Recoverable issues (LFS, submodules detected)
|
|
447
|
+
- **ERROR**: Failures, execution errors
|
|
448
|
+
|
|
449
|
+
Logs are particularly useful when troubleshooting SSH connection issues, Git command failures, or understanding the synchronization flow.
|
|
450
|
+
|
|
272
451
|
## For Developers
|
|
273
452
|
|
|
274
453
|
To develop this repository itself, install dependencies using `uv sync`.
|
|
@@ -277,6 +456,16 @@ To develop this repository itself, install dependencies using `uv sync`.
|
|
|
277
456
|
uv sync
|
|
278
457
|
```
|
|
279
458
|
|
|
459
|
+
To install from TestPyPI:
|
|
460
|
+
|
|
461
|
+
```bash
|
|
462
|
+
uv tool install \
|
|
463
|
+
--index-url https://test.pypi.org/simple/ \
|
|
464
|
+
--extra-index-url https://pypi.org/simple/ \
|
|
465
|
+
--index-strategy unsafe-best-match \
|
|
466
|
+
git-ssh-sync
|
|
467
|
+
```
|
|
468
|
+
|
|
280
469
|
To execute the CLI during development, you can run it via `uv run`.
|
|
281
470
|
|
|
282
471
|
```bash
|
|
@@ -10,6 +10,8 @@
|
|
|
10
10
|
|
|
11
11
|
`git-ssh-sync` is a CLI tool for synchronizing Git commits created in a development environment that cannot directly access GitHub/GitLab to external Git services via a local machine.
|
|
12
12
|
|
|
13
|
+
This tool is designed for niche environments where outbound network access is restricted, such as high-security enterprises and projects that only allow limited inbound communication (e.g., SSH, RDP).
|
|
14
|
+
|
|
13
15
|
This is not a file synchronization tool. It synchronizes Git objects and branches. Source editing, building, testing, and committing are performed in the development environment, while communication with GitHub/GitLab is handled by the local machine.
|
|
14
16
|
|
|
15
17
|
## Prerequisites
|
|
@@ -77,8 +79,21 @@ Key parameters:
|
|
|
77
79
|
- `--origin`: Repository URL on the GitHub / GitLab side
|
|
78
80
|
- `--dev-host`: SSH host of the development environment
|
|
79
81
|
- `--dev-user`: SSH user of the development environment
|
|
82
|
+
- `--dev-os`: Development environment OS, either `posix` or `windows` (default: `posix`)
|
|
80
83
|
- `--dev-path`: Path to the work repository on the development environment
|
|
81
84
|
|
|
85
|
+
For a Windows development environment, specify `--dev-os windows` and use Windows
|
|
86
|
+
paths. Windows SSH commands are executed through PowerShell.
|
|
87
|
+
|
|
88
|
+
```powershell
|
|
89
|
+
git-ssh-sync init myproject `
|
|
90
|
+
--origin git@github.com:example/myproject.git `
|
|
91
|
+
--dev-host devserver `
|
|
92
|
+
--dev-user user `
|
|
93
|
+
--dev-os windows `
|
|
94
|
+
--dev-path C:\Users\user\work\myproject
|
|
95
|
+
```
|
|
96
|
+
|
|
82
97
|
For `--origin`, specify a remote URL that can be used with `git clone` or `git fetch`. Main formats are:
|
|
83
98
|
|
|
84
99
|
```text
|
|
@@ -102,6 +117,29 @@ git-ssh-sync init myproject \
|
|
|
102
117
|
--force
|
|
103
118
|
```
|
|
104
119
|
|
|
120
|
+
You can inspect and maintain registered projects without opening the config file directly.
|
|
121
|
+
|
|
122
|
+
```bash
|
|
123
|
+
# List registered projects
|
|
124
|
+
git-ssh-sync config list
|
|
125
|
+
|
|
126
|
+
# Show all settings for one project
|
|
127
|
+
git-ssh-sync config show myproject
|
|
128
|
+
|
|
129
|
+
# Update selected settings
|
|
130
|
+
git-ssh-sync config set myproject \
|
|
131
|
+
--origin git@github.com:example/myproject.git \
|
|
132
|
+
--dev-host devserver \
|
|
133
|
+
--dev-os posix \
|
|
134
|
+
--dev-path /home/user/work/myproject
|
|
135
|
+
|
|
136
|
+
# Remove a project after confirmation
|
|
137
|
+
git-ssh-sync config remove myproject
|
|
138
|
+
|
|
139
|
+
# Remove a project without an interactive prompt
|
|
140
|
+
git-ssh-sync config remove myproject --yes
|
|
141
|
+
```
|
|
142
|
+
|
|
105
143
|
## Initial Workflow
|
|
106
144
|
|
|
107
145
|
For the first time, execute configuration, clone to the development environment, and diagnostics in order.
|
|
@@ -126,6 +164,54 @@ Afterward, the work repository on the development environment can be used as a n
|
|
|
126
164
|
|
|
127
165
|
`doctor` checks the local environment, SSH connection, fetch/push permissions to origin, and repository deployment on the development environment. Run this not only for the first time but also when synchronization is not working properly.
|
|
128
166
|
|
|
167
|
+
## Attaching Existing Repositories
|
|
168
|
+
|
|
169
|
+
If the gateway repository, development work repository, or cache repository already
|
|
170
|
+
exists, use `attach` instead of `clone`.
|
|
171
|
+
|
|
172
|
+
```bash
|
|
173
|
+
git-ssh-sync init myproject \
|
|
174
|
+
--origin git@github.com:example/myproject.git \
|
|
175
|
+
--dev-host devserver \
|
|
176
|
+
--dev-user user \
|
|
177
|
+
--dev-path /home/user/work/myproject
|
|
178
|
+
git-ssh-sync attach myproject --dry-run
|
|
179
|
+
git-ssh-sync attach myproject
|
|
180
|
+
git-ssh-sync doctor myproject
|
|
181
|
+
```
|
|
182
|
+
|
|
183
|
+
`attach` inspects the configured origin URL, current branch, development work
|
|
184
|
+
tree state, bare cache repository, and `gitsync` remote. Before changing
|
|
185
|
+
anything, it prints the operations it will apply. Use `--yes` for non-interactive
|
|
186
|
+
execution after reviewing the plan.
|
|
187
|
+
|
|
188
|
+
```bash
|
|
189
|
+
git-ssh-sync attach myproject --yes
|
|
190
|
+
```
|
|
191
|
+
|
|
192
|
+
If only the `gitsync` remote or cache wiring is missing or mismatched, run
|
|
193
|
+
`doctor --repair` to inspect and repair it through the same preflight checks.
|
|
194
|
+
|
|
195
|
+
```bash
|
|
196
|
+
git-ssh-sync doctor myproject --repair
|
|
197
|
+
git-ssh-sync doctor myproject --repair --yes
|
|
198
|
+
```
|
|
199
|
+
|
|
200
|
+
After an interrupted `pull` or `push`, use `recover` as the recovery-oriented
|
|
201
|
+
entry point. Without `--yes`, it diagnoses origin, gateway, cache, and work
|
|
202
|
+
repository state and prints concrete next actions. With `--yes`, it applies only
|
|
203
|
+
safe wiring repairs such as creating the cache repository, seeding the cache
|
|
204
|
+
branch, or fixing the `gitsync` remote.
|
|
205
|
+
|
|
206
|
+
```bash
|
|
207
|
+
git-ssh-sync recover myproject
|
|
208
|
+
git-ssh-sync recover myproject --yes
|
|
209
|
+
```
|
|
210
|
+
|
|
211
|
+
`attach` and `doctor --repair` do not commit, stash, merge, or rebase existing
|
|
212
|
+
work. If the development work tree is dirty, or if a path is not a compatible Git
|
|
213
|
+
repository, the command stops and prints the manual recovery action.
|
|
214
|
+
|
|
129
215
|
## Daily Development Workflow
|
|
130
216
|
|
|
131
217
|
For daily development, `pull` from the local machine before starting work, commit normally in the development environment, and finally `push` from the local machine.
|
|
@@ -153,6 +239,13 @@ git-ssh-sync push myproject
|
|
|
153
239
|
|
|
154
240
|
`pull` and `push` target the current branch of the work repository on the development environment. To synchronize a different branch, switch the work repository branch with `checkout` first.
|
|
155
241
|
|
|
242
|
+
Use `--dry-run` to inspect the planned operations and preflight checks before changing refs:
|
|
243
|
+
|
|
244
|
+
```bash
|
|
245
|
+
git-ssh-sync pull myproject --dry-run
|
|
246
|
+
git-ssh-sync push myproject --dry-run
|
|
247
|
+
```
|
|
248
|
+
|
|
156
249
|
## Branch Switching Workflow
|
|
157
250
|
|
|
158
251
|
To switch to an existing branch, execute `checkout` from the local machine.
|
|
@@ -169,6 +262,13 @@ To create a new branch, use `-b`. Use `--base` together to explicitly specify th
|
|
|
169
262
|
git-ssh-sync checkout myproject -b feature/foo --base develop
|
|
170
263
|
```
|
|
171
264
|
|
|
265
|
+
To preview a branch switch or branch creation without changing origin, cache, or work repo refs:
|
|
266
|
+
|
|
267
|
+
```bash
|
|
268
|
+
git-ssh-sync checkout myproject feature/foo --dry-run
|
|
269
|
+
git-ssh-sync checkout myproject -b feature/foo --base develop --dry-run
|
|
270
|
+
```
|
|
271
|
+
|
|
172
272
|
Development environment:
|
|
173
273
|
|
|
174
274
|
```bash
|
|
@@ -202,6 +302,20 @@ To list existence status and ahead/behind for each branch, use `branch`.
|
|
|
202
302
|
git-ssh-sync branch myproject
|
|
203
303
|
```
|
|
204
304
|
|
|
305
|
+
To inspect the development work repo directly from the local machine, use the
|
|
306
|
+
read-only `dev` commands.
|
|
307
|
+
|
|
308
|
+
```bash
|
|
309
|
+
git-ssh-sync dev status myproject
|
|
310
|
+
git-ssh-sync dev diff myproject
|
|
311
|
+
git-ssh-sync dev diff myproject --stat
|
|
312
|
+
git-ssh-sync dev log myproject --max-count 5
|
|
313
|
+
```
|
|
314
|
+
|
|
315
|
+
These commands run `git status`, `git diff`, or `git log` on the development
|
|
316
|
+
work repo over SSH. They do not update origin, the local gateway repo, the
|
|
317
|
+
development cache repo, or the development work repo refs.
|
|
318
|
+
|
|
205
319
|
## Operational Rules
|
|
206
320
|
|
|
207
321
|
When using `git-ssh-sync`, following these rules makes it easier to understand the state:
|
|
@@ -233,6 +347,12 @@ git-ssh-sync init myproject \
|
|
|
233
347
|
--dev-user user \
|
|
234
348
|
--dev-path /home/user/work/myproject
|
|
235
349
|
|
|
350
|
+
# List registered project settings
|
|
351
|
+
git-ssh-sync config list
|
|
352
|
+
|
|
353
|
+
# Show registered project settings
|
|
354
|
+
git-ssh-sync config show myproject
|
|
355
|
+
|
|
236
356
|
# Initial clone
|
|
237
357
|
git-ssh-sync clone myproject
|
|
238
358
|
|
|
@@ -242,6 +362,12 @@ git-ssh-sync status myproject
|
|
|
242
362
|
# Check branch status
|
|
243
363
|
git-ssh-sync branch myproject
|
|
244
364
|
|
|
365
|
+
# Inspect development work repo status
|
|
366
|
+
git-ssh-sync dev status myproject
|
|
367
|
+
|
|
368
|
+
# Inspect development work repo diff
|
|
369
|
+
git-ssh-sync dev diff myproject --stat
|
|
370
|
+
|
|
245
371
|
# Reflect changes from origin to development environment
|
|
246
372
|
git-ssh-sync pull myproject
|
|
247
373
|
|
|
@@ -256,8 +382,61 @@ git-ssh-sync checkout myproject -b feature/foo --base develop
|
|
|
256
382
|
|
|
257
383
|
# Diagnostics
|
|
258
384
|
git-ssh-sync doctor myproject
|
|
385
|
+
|
|
386
|
+
# Diagnose and optionally repair after an interrupted sync
|
|
387
|
+
git-ssh-sync recover myproject
|
|
388
|
+
git-ssh-sync recover myproject --yes
|
|
389
|
+
```
|
|
390
|
+
|
|
391
|
+
## Logging
|
|
392
|
+
|
|
393
|
+
`git-ssh-sync` supports detailed logging for troubleshooting and monitoring synchronization operations.
|
|
394
|
+
|
|
395
|
+
### Log Levels
|
|
396
|
+
|
|
397
|
+
By default, only warnings and errors are displayed. You can increase verbosity using the following options:
|
|
398
|
+
|
|
399
|
+
- `--verbose`, `-v`: Enable INFO level logging (operation progress, Git/SSH commands)
|
|
400
|
+
- `--debug`, `-d`: Enable DEBUG level logging (all debug information, command output, stack traces)
|
|
401
|
+
|
|
402
|
+
### Log File Output
|
|
403
|
+
|
|
404
|
+
Logs are automatically saved to `~/.cache/git-ssh-sync/logs/git-ssh-sync.log`. The log file contains all log levels (DEBUG and above) regardless of console output settings.
|
|
405
|
+
|
|
406
|
+
You can specify a custom log file path using `--log-file`:
|
|
407
|
+
|
|
408
|
+
```bash
|
|
409
|
+
git-ssh-sync pull myproject --log-file /tmp/my-sync.log
|
|
259
410
|
```
|
|
260
411
|
|
|
412
|
+
### Usage Examples
|
|
413
|
+
|
|
414
|
+
```bash
|
|
415
|
+
# Default (warnings and errors only)
|
|
416
|
+
git-ssh-sync pull myproject
|
|
417
|
+
|
|
418
|
+
# Verbose output (operation progress)
|
|
419
|
+
git-ssh-sync pull myproject --verbose
|
|
420
|
+
|
|
421
|
+
# Debug output (all details including command execution)
|
|
422
|
+
git-ssh-sync pull myproject --debug
|
|
423
|
+
|
|
424
|
+
# Verbose with custom log file
|
|
425
|
+
git-ssh-sync push myproject --verbose --log-file /tmp/sync.log
|
|
426
|
+
|
|
427
|
+
# Debug output for diagnostics
|
|
428
|
+
git-ssh-sync doctor myproject --debug
|
|
429
|
+
```
|
|
430
|
+
|
|
431
|
+
### Log Content
|
|
432
|
+
|
|
433
|
+
- **INFO**: Operation progress (pull/push/checkout), success messages
|
|
434
|
+
- **DEBUG**: Git/SSH commands executed, return codes, stdout/stderr, working directories
|
|
435
|
+
- **WARNING**: Recoverable issues (LFS, submodules detected)
|
|
436
|
+
- **ERROR**: Failures, execution errors
|
|
437
|
+
|
|
438
|
+
Logs are particularly useful when troubleshooting SSH connection issues, Git command failures, or understanding the synchronization flow.
|
|
439
|
+
|
|
261
440
|
## For Developers
|
|
262
441
|
|
|
263
442
|
To develop this repository itself, install dependencies using `uv sync`.
|
|
@@ -266,6 +445,16 @@ To develop this repository itself, install dependencies using `uv sync`.
|
|
|
266
445
|
uv sync
|
|
267
446
|
```
|
|
268
447
|
|
|
448
|
+
To install from TestPyPI:
|
|
449
|
+
|
|
450
|
+
```bash
|
|
451
|
+
uv tool install \
|
|
452
|
+
--index-url https://test.pypi.org/simple/ \
|
|
453
|
+
--extra-index-url https://pypi.org/simple/ \
|
|
454
|
+
--index-strategy unsafe-best-match \
|
|
455
|
+
git-ssh-sync
|
|
456
|
+
```
|
|
457
|
+
|
|
269
458
|
To execute the CLI during development, you can run it via `uv run`.
|
|
270
459
|
|
|
271
460
|
```bash
|