title: Submodule: Permission denied (publickey)
body: <p>We have a weird issue with our git repository. We reference two submodules <em>(not sure if it matters: the one that makes troubles lies on bitbucket cloud while the repo and the other submodule lie on the same bitbucket server instance)</em> </p>
  
  <p>If someone wants to freshly check out the repository, they get the following error:</p>
  
  <pre><code>Cloning into local/path…
  Warning: Permanently added the RSA host key for IP address 
  xx.xxx.xxx.xxx to the list of known hosts.
  
  Permission denied (publickey).
  fatal: Could not read from remote repository.
  </code></pre>
  
  <p>What I would expect is not properly setup ssh keys <strong>but here comes the odd part:</strong> If we manually copy over the submodules contents through the filesystem, from that moment on everything works fine and pulling, switching branches in the submodule etc works just fine. </p>
  
  <p>This made me assume that some of the git settings are in the submodule folders that i am copying over, but actually there are only two git files:
  The gitignore (which doesnt ignore anything special/suspicious) and a .git file which only contains 
  gitdir: ../../../.git/modules/path/to/submodule</p>
  
  <p>This should not have anything to do with permissions, so can anyone explain why a manual copy fixes the permission issues? </p>