Utility to copy code to and from remote hosts over SSH.
git-repo-sync
synchronizes code to and from a remote host over SSH:
- It respects
.gitignore
: Files that are ignored through the local.gitignore
are never synchronized (in both directions). - It only copies files that are different (based on file size).
- It will remove files if they were removed on the other end.
git-repo-sync
fully supports Linux and macOS. Windows is supported only when
used as the "local" host, not as a remote.
- Git
- SSH with SFTP support (included by default)
Download the latest release from GitHub releases and place it anywhere in your path.
Warning
git-repo-sync
is a tool to synchronize files: It will delete your
files on the other end. Make sure to always do a dry run before running it to
prevent losing files.
To upload the current directory to a remote location:
git repo-sync up <remote-host>:<target-directory>
For example:
git repo-sync up user@server:/home/user/target-dir
If the host is already part of your SSH config:
git repo-sync up myserver:project
The above command will sync the current directory to the project directory on the remote (in home).
To sync the directory from a remote host to the local host:
git repo-sync down <remote-host>:<target-directory>
For example:
git repo-sync down myserver:project
The above command will sync the project
directory contents back into the
current directory.
To specify a different local directory (other than the current directory), use
the --local-dir
option. For example:
git repo-sync --local-dir /tmp/project up user@remote:~/project
Other options:
- Use the
--verbose
flag to log all actions that have been taken. - Use the
--dry
flag to print whatgit-repo-sync
would do, without actually doing it.
Note
All additional flags must be placed before the up
or down
command, or they
will not be recognized.
Licensed under either of
- Apache License, Version 2.0 (LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0)
- MIT license (LICENSE-MIT or http://opensource.org/licenses/MIT)
at your option.
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.