rsync private Git avoid sharing credentials
Recommended: rather than using Rsync, it is more convenient to give the remote host read-only Git access via:
- per-repo (cannot share between repos) SSH Deploy Keys
- (all repos you authorize) Oauth tokens for HTTPS clone.
Rsync over SSH allows one to edit and update code without putting credentials on the remote host.
Laptop to remote host:
rsync -r -t -v -z --exclude={build/,.git/} ~/myProg login@host:myProg--exclude={build/,.git/}- Exclude syncing of Git information and build/ directory, which wastes time and may fail
-z --compress- compress data for transfer
-r --recursive- recursively sync directories
-t --times- preserve modification times
-v --verbose- verbose output