I want to clone an open, public repo into a different directory. To do this from the command line I type:
git clone [email protected]:computersarecool/dotfiles.git documents/gitprojects/dotfiles
which works.
However, now I want to do it from a bash script. In the script I have literally the exact same code:
#!/bin/bash
git clone [email protected]:computersarecool/dotfiles.git documents/gitprojects/dotfiles
but now I get an error:
Permission denied (publickey).
fatal: Could not read from remote repository.
Please make sure you have the correct access rights and the repository exists.
Can anyone explain the issue to me? I do not even understand why it is asking for a publickey in the first place as the repo is open.
sudoor as a different user or fromcronor somesuch?sudo! Is there a way to account for this?git clone [email protected]:...is connecting over SSH. It has to authenticate to the remote SSH daemon before it's able to talk to anything git-specific, so whether the repo is authenticated or not is completely irrelevant: it hasn't finished transport-layer negotiation and authentication at the point when it fails, so whether there's any kind of application-layer access control or not is moot.