この記事を書いた動機
単に、リポジトリを作るところまではうまく行っていたのですが、リポジトリをクローンするときに、ユーザ名の指定をわかっておらず、ずっと以下のように間違った"git"というユーザを指定し続けていてなかなか気づけなかったということがあったのでメモすることにしました。
git clone git@[serveradress]:/Path/To/Target/Proejct/Root/Folder
ちなみに、間違ったユーザを指定していると、ssh接続できないので、ずっと"Permission denied (publickey).“と言われ続けます。。。最初はなんでssh コマンド経由でつながるのに、gitではうまくいかないのかみたいになっていましたが、結局のところ間違ったユーザを意図せず指定し続けていただけなのでした。。。
リポジトリを作る
cd /Path/To/Target/Proejct/Root/Folder
git init --bare
リポジトリをクローン
git clone [username]@[serveradress]:/Path/To/Target/Proejct/Root/Folder
参考にしたサイトとか
- debugging - How can I debug git/git-shell related problems? - Stack Overflow
https://stackoverflow.com/questions/6178401/how-can-i-debug-git-git-shell-related-problems (2025年3月10日) - Git - Setting Up the Server
https://git-scm.com/book/en/v2/Git-on-the-Server-Setting-Up-the-Server (2025年3月10日) - Why doesn’t my SSH key work for connecting to github? - Stack Overflow
https://stackoverflow.com/questions/9960897/why-doesnt-my-ssh-key-work-for-connecting-to-github (2025年3月10日) - ChatGPT
https://chatgpt.com/ (2025年3月10日)