Services
Company
Blog
Contact
Open Source

How To Copy A Git Repo To Another Location Using Rsync On macOS

Michael Argentini Avatar
Michael ArgentiniWednesday, June 14, 2023

Here's a Mac pro tip: When copying a git repository directory to your network file server using rsync, try this:

rsync -brtlvP --chmod=Fu+w --delete-before Code/MyProject/ /Volumes/MyServer/Code/MyProject/

This will copy the files with timestamps but no other attributes, and will also give the file owner (you) full access rights. This ensures that you (or even Windows users with access rights) can overwrite the directory contents later because local read-only files (e.g. in the .git directory) won't be read-only on the server. You can also change the chmod option to customize the rights, like ensuring everyone has full control.

© 2025, Fynydd LLC / King of Prussia, Pennsylvania; United States / +1 855-439-6933

By using this website you accept our privacy policy. Choose the browser data you consent to allow:

Only Required
Accept and Close