title: How do I keep two git repositories in sync?
body: <p>Here is the scenario. I have two machines, "desktop" and "laptop".</p>
  
  <p>On desktop I do:</p>
  
  <pre><code>mkdir git_test
  cd git_test
  git init
  dd if=/dev/urandom of=test.img bs=1k count=1000
  git add test.img
  git commit -m "Added first image"
  </code></pre>
  
  <p>Then on laptop I do:</p>
  
  <pre><code>git clone [USER]@desktop:/home/[USER]/git_test    
  cd git_test
  dd if=/dev/urandom of=test2.img bs=1k count=1000
  git add test2.img
  git commit -m "Added second image"
  </code></pre>
  
  <p>Then I want the git repo on my desktop to look like the git repo on my laptop. On the laptop, I issue the following:
       git push origin master</p>
  
  <p>But then I get:</p>
  
  <pre><code>remote: error: refusing to update checked out branch: refs/heads/master
  remote: error: By default, updating the current branch in a non-bare repository
  remote: error: is denied, because it will make the index and work tree inconsistent
  remote: error: with what you pushed, and will require 'git reset --hard' to match
  remote: error: the work tree to HEAD.
  remote: error: 
  remote: error: You can set 'receive.denyCurrentBranch' configuration variable to
  remote: error: 'ignore' or 'warn' in the remote repository to allow pushing into
  remote: error: its current branch; however, this is not recommended unless you
  remote: error: arranged to update its work tree to match what you pushed in some
  remote: error: other way.
  remote: error: 
  remote: error: To squelch this message and still keep the default behaviour, set
  remote: error: 'receive.denyCurrentBranch' configuration variable to 'refuse'.
  </code></pre>
  
  <p>How do I keep these two repos in sync?</p>
  
  <p>The error messages seem to imply that git has the functionality that I desire, but for some reason it seems to be a more advanced workflow. I heard someone say once that you can't push to the branch you are currently on, can someone elaborate on that as a possible solution? I would have no problem with a solution of that nature, ie, I could work on a certain branch on my laptop, and a different branch on my desktop, and then just sync those up somehow so they are identical. </p>
  
  <p><em>Please note the following!</em></p>
  
  <ul>
  <li><p>I do not want to use a centralized repo, like github, for several reasons. The first is security. The second is simplicity. The third is that due to circumstances I won't go into here, I can't count on having an internet connection to some remote server, I just have my two machines connected via LAN. Finally, I want to learn how to do things the way I requested here, as to gain that specific piece of knowledge.</p></li>
  <li><p>I also do not want to use a bare repo, as a bare repo has a bunch of cruft in the root dir. This is ugly and messy. The whole reason I moved to git from subversion is that git looked like a much cleaner, decentralized solution. Also, I have some somewhat non-technical people that will be operating in the root dir of the desktop, they will get quite confused by the cruft. The beauty of git is (I thought) that everything hides in .git folders. Edit: Apparently I wasn't clear enough with this point. Imagine I have a "Documents" folder with the following sub folders: mydata1 and mydata2. This isn't a contrived example, this is exactly the issue I am trying to deal with. mydata1 should contain "test.img" and that file only, but instead it now has:</p>
  
  <p>branches
  config
  description
  HEAD
  hooks
  info
  objects
  refs</p></li>
  </ul>
  
  <p>I wanted to be able to just cd into mydata1 and start editing files, but instead I have to try and cd through branches, or whatever even just to get work done. And to have this sort of directory structure for <em>every</em> subfolder that was in "documents" is just unworkable. Please, please don't tell me to do things this way. Please just answer the question. Thanks.</p>
  
  <p>These two points are the <em>entire</em> reason I am posting this question here. Please only reply if you have an answer to this question. :) Thanks!!</p>