If the old and new filesystems are both accessible to your machine, then consider using a symbolic link instead of rsync. If your rsync command you're using does not specify hosts (or if they are the same host), then this is the case. You're trying to mirror two directories with a different name on the same host. Don't use rsync for this, since you are duplicating the data, and you will have to run your rsync often to keep them in sync.
Using a symbolic link is a one-time fix that will mirror two directories (with different names) and requires almost no space. It's like creating an alias directory that points to another directory.
Let's say you had the old git in a directory called /old/path/old_git and now the code repository has moved to /new/path/new_git
You can do:
cd /old/path
rm -rf old_git (if you still have it there, get rid of it, or move it out of the way)
ln -s /new/path/new_git old_git
This will create a link as such:
/old/path/old_git -> /new/path/new_git
So that anything that is put into new_git will be instantly available the old way as well, without duplicating data, and without having to constantly sync them.
srcdirectory underdestdirectory – Zen Jan 08 '15 at 09:23rsyncI've ever used. If that's actually happening to you, you're missing the trailing slash at the end of the source directory argument. – Adrian Jan 08 '15 at 09:45destis a symlnk tosrc, it instead ends up copyingsrctosrc/src. Tested on macOS. Was hoping that I could replacebar -> foo/withbar/, but had to use an intermediate temporary directory. – user5359531 May 02 '18 at 03:25destis a symlink tosrc, simplyrm destbefore running the above command.rsyncis smart enough to createdestbefore copying the contents ofsrc. You don't need an intermediate temp dir. – Adrian May 02 '18 at 16:26rsyncfor Windows from Cygwin then-awouldn't work correctly.-aimplies a few options including-pgo. It changes target folder's permission and you can't use it. Use commandicacls dest /T /Q /C /RESETto reset persmissions. My command is looking as the followingrsync -rlt src/ dest. – Maxim Suslov May 28 '18 at 00:13destdoesn't have to exist already for this to work. – Flimm Jun 07 '22 at 15:03