Synchronise git repositories between this machine and a remote host via SSH. Uses nbs-local-run for SSH credentials — the nbs-ts-helper must be running.
nbs-remote-git <host> <remote-path> <command> [args]Clone a repository from a remote machine to a local path.
nbs-remote-git <host> <remote-path> clone <local-path>Example:
nbs-remote-git build-server.example.com /home/user/project clone /local/projectPush local commits to the remote repository. Adds a git remote on first use.
nbs-remote-git <host> <remote-path> push [branch]Must be run from inside a local git repository. The branch defaults to HEAD if not specified.
Example:
cd /local/project
nbs-remote-git build-server.example.com /home/user/project push my-branchFetch (or pull a specific branch) from the remote repository. Adds a git remote on first use.
nbs-remote-git <host> <remote-path> pull [branch]Without a branch argument, runs git fetch. With a branch, runs git pull.
Example:
cd /local/project
nbs-remote-git build-server.example.com /home/user/project pull mainShow the remote repository's recent commits and working tree status.
nbs-remote-git <host> <remote-path> statusUses nbs-remote-run (not nbs-local-run) because it runs git on the remote machine.
Example:
nbs-remote-git build-server.example.com /home/user/project statusclone,push, andpullwrap git commands innbs-local-run, which provides SSH credentials through the nbs-ts-helper daemon.statususesnbs-remote-runto execute git commands on the remote machine directly.- On first
pushorpull, the tool adds a git remote namedremote-<hostname>(e.g.remote-build-server). Subsequent operations reuse it.
- nbs-ts-helper must be running. Without it, SSH fails. Start it with
nbs-ts-helperin a user terminal ornbs-ts-sysctl start. - The remote path must be a git repository. For
clone, it must exist on the remote. Forpush, the remote repo must accept pushes (not a bare checkout with uncommitted changes on the target branch).
| Code | Meaning |
|---|---|
| 0 | Success |
| 1 | Operation failed (git error, SSH failure, not a repo) |
| 4 | Invalid arguments |
Use nbs-remote-git when you need to synchronise code between this machine and a remote build/test machine. Do not use nbs-remote-edit for this — nbs-remote-edit is for individual files, nbs-remote-git is for whole repositories.
If you only need to run a command on the remote machine without syncing code, use nbs-remote-run instead.
"helper connect failed" — the nbs-ts-helper is not running. Start it.
"does not appear to be a git repository" — the remote path is wrong. Check it with nbs-remote-run <host> "ls -la <path>/.git".
"Permission denied" — SSH credentials are not available. Restart the helper.