title: git checkout error: cannot create directory: Permission denied
body: <p>I am facing issues with the git checkout command. Please help.</p>
  
  <p>Here is what I did.</p>
  
  <ol>
  <li>Created a local directory. Created some files. Initiated a git repo locally.</li>
  <li>Created a repo in bitbucket &amp; pushed my local repo to bitbucket</li>
  <li>Created a new branch locally, b01</li>
  <li>Added new files to b01, committed them and successfully pushed the branch to bitbucket</li>
  <li>Now I am trying to merge b01 with master and that is where I am facing issues. I am not able to checkout master.</li>
  </ol>
  
  <p>Lists of commands used and the error details:</p>
  
  <pre><code>git clone [my repo]
  git checkout -b b01
  </code></pre>
  
  <p>Hereafter I made multiple changes, including creating new files and directories, committed those changes and successfully pushed the changes on that branch to the repo. like:</p>
  
  <pre><code>git push -u origin b01
  </code></pre>
  
  <p>Now I am done with the changes and want to merge it to the master branch. So I do a:</p>
  
  <pre><code>git checkout master
  </code></pre>
  
  <p>Here is the error it throws:</p>
  
  <pre><code>fatal: cannot create directory at 'workfolder': Permission denied
  </code></pre>
  
  <p>Git keeps me in b01, but <em>deletes ALL the files I had created in the branch.</em> 
  So if I now do a </p>
  
  <pre><code>git status
  </code></pre>
  
  <p>it shows me: </p>
  
  <pre><code>On branch b01
  Your branch is upto date with 'orgin/b01'
  Changes not staged for commit:
  (use "git add/rm .....)
    deleted: new file1
    deleted: new file2
  &lt;list of the new files I had added but which got deleted as a result of the command&gt;
  </code></pre>
  
  <p>I am having to run a </p>
  
  <pre><code>git checkout -- . 
  </code></pre>
  
  <p>to restore the files.</p>
  
  <p>Please help. </p>