Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Hosting a Git repository on an AWS Windows Server

I'm trying to host my own private Git setup on an AWS Windows Server instance.

Here is my setup:

  • OpenSSH installed via cygwin
    • This works. I have successfully SSHed into my server
  • Git Daemon installed via cygwin
    • This seems to work. I have successfully created and cloned repos locally using the Git bash
  • Outgoing Firewall rule allowing TCP on ports 22 and 9418
  • Incoming Firewall rule allowing TCP on ports 22 and 9418
    • I'm not sure this is required.

As far as I can tell, this is all I need, except that I can't clone the repo.

I'm using this command remotely:

git clone ssh://[email protected]/git/myRepo

And I get this output:

Clone into 'myRepo'
fatal: Could not read from the remote repository

Please make sure you have the correct access rights
and the repository exists.

However, the exact same command works fine when I run it on myServer's through Git bash... which leads me to believe this is a firewall issue. I can't seem to find which port is needed, though.

Extra details:

  • My repo was initialized using git init --bare --shared
  • My AWS Instance's security group (SG) has the following rules (currently for debugging)
    • Inbound
      • Port, Source: ALL 0.0.0.0/0
    • Outbound
      • Port, Source: ALL 0.0.0.0/0

Does anyone know what I'm missing?

Thanks.

like image 933
MetaFight Avatar asked Dec 18 '25 20:12

MetaFight


1 Answers

Are you sure that the 'myUser' user has access to /git/myRepo? Note that that's root-relative, not relative to myUser's home dir.

If you want the path to be relative to the user's home dir, try a clone url of the format [email protected]:git/myRepo.

Also make sure that a bare repo's been created in /git/myRepo - i.e. if you ls /git/myRepo, you see HEAD, hooks, refs, config, etc.

like image 149
canton7 Avatar answered Dec 21 '25 13:12

canton7



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!