I'm following along with a Railscast that teaches how to set up Chef solo. It uses two interesting terminal commands that I had never seen before, only one of which I can get to work. When I doscp -r root@198.xxx.xxx.xxx:/var/chef .It copies the contents of the remote server directory to my local machine. The following command is supposed to sync the files back to the server after I change them on my machinersync -r . root@198.XXX.XXX.XXX:/var/chefHowever, the changes aren't showing on the remote server, and when I run the chef commands that are supposed to apply the changes, it's not showing any changes that need to be made.Am I using rsync incorrectly?UpdateRunning this command gave the following output. Still no changes are shown on the remote serverrsync -rvv . root@198.XXX.XXX.XXX:/var/chef`building file list ... donedelta-transmission enabledchef/node.jsonchef/solo.rbchef/cache/chef-client-running.pidchef/cache/chef-stacktrace.outchef/chef/node.jsonchef/chef/solo.rbchef/chef/cache/chef-client-running.pidchef/chef/cache/chef-stacktrace.outchef/chef/cookbooks/main/recipes/default.rbchef/cookbooks/main/recipes/default.rbchef/cookbooks/main/templates/default/zshrc.erbtotal: matches=17  hash_hits=17  false_alarms=0 data=0sent 1167 bytes  received 442 bytes  643.60 bytes/sectotal size is 6236  speedup is 3.88`UpdateYou'll notice from the above update that a templates directory should be inside the main directory (along with a recipes directory), however, this is what's showing root@Chef3:/var/chef/cookbooks# cd mainroot@Chef3:/var/chef/cookbooks/main# lsrecipes
why isn't rsync copying files to the server
rsync
You have two file hierarchies mixed up: /var/chef and /var/chef/chef. It looks like you're editing one and then reading back the other.scp -r root@198.xxx.xxx.xxx:/var/chef . creates a chef directory inside the current directory. If you ran that from /var/chef.The proposed commands are terrible. Forget everything you read in that tutorial.scp -r does not preserve file permissions or times. Use scp -rp to preserve them.rsync -r does not preserve file permissions or times. Forget that the -r option exists. Use rsync -a instead, which preserves all usual metadata. Always pass the -a option to rsync unless you have a good reason not to.When you write rsync -a /path/to/source /path/to/destination, this creates a subdirectory called source under destination. If you want to synchronize /path/to/source with /path/to/destination instead, add a final / at the end of the destination: rsync -a /path/to/source /path/to/destination/ copies /path/to/source/somefile to /path/to/destination/somefile.It's very important to preserve the file's modification times. That way you know when a file has last been modified. Your tools also know when a file has been modified. In particular, synchronizing a large directory in which most files haven't been modified is a lot faster if the file times are reliable. Rsync will skip a file quickly if the name, size and modification time are the same on both sides.You can tell rsync to transfer only files that are newer on the source side by adding the -u option (rsync -au SOURCE DESTINATION). This limits the risks if the files have also been edited on the destination side: you won't erase the newer version that is on the destination side with the older copy on the source side. However you cannot reliably detect conflicts: if a file has been edited on both sides, whichever version has the most recent modification time will win.Rsync is a tool to synchronize data in one direction. Do not use it to synchronize in both directions. Instead, use Unison. Unison maintains a list of file versions each time you run it and will complain loudly if there is ever a conflict (same file edited independently on both sides). As long as there is no conflict (i.e. as long as each file is only modified on one side between synchronizations), Unison will merge the changes on the two sides.To set up Unison, use the GUI, or create a preferences file called ~/.unison/chef.prf containingroot = /var/chefroot = server.example.com:/var/cheftimes = trueRun unison -auto chef to synchronize the two trees.Rather than synchronizing files, you should put your files under version control. When you've made changes, commit them to the repository. To deploy your changes, check them out on the server.