I followed this tutorial to set up a git repository on an EC2 instance.
http://git-scm.com/book/ch4-4.html. Basically, I add a new git
user and include my public key in authorized_keys. After setting up the git
user, I just initialize a new repo by git init --bare
.
However, I've noticed that I can clone it easily without needing my private key. Is there a way to force it to only be available via SSH so authorized_keys is followed? I'm guessing it's using the default of git which is port 9418 which doesn't seem to support authentication.
Best Answer
Port 9814 is where
git-daemon
runs (e.g clone,git clone git://git.example.com/repo
). This is meant for an internalgit
repository. Read the documentation for more details.You have 2 other options for setting up a remote
git
server:git clone ssh://git.example.com/git/repo
git clone https://git.example.com/git/repo
SSH is a lot easier to setup. You just need to make sure all contributors have access to the SSH account. This is normally done via SSH keys---each developer adds their public key to a
git
SSH account.Just remember:
ssh
,git
,http
orhttps
).ssh
https
git
and port 80 forhttp