1

I have a git repository setup on a remote server XXX.XXX.XXX.XXX and want to clone the same in my windows environment. It's actually a webapp present under /var/www/html/Testsite. The git repo is created inside the Testsite folder.

I was hoping the command:

git clone http://XXX.XX.XX.XX/Testsite/mysite.git would work fine but it does not. Please let me know how I can get the URL to configure and clone it into my environment.

However, with the local folder, I am easily able to clone the repository which works totally fine.

Thanks a lot.

gturri
  • 13,807
  • 9
  • 40
  • 57
girish
  • 305
  • 3
  • 16
  • 1
    What is the error you get when you try to clone it? Also, can you ping the remote server? – gravetii Jan 22 '14 at 05:57
  • i get a repository not found error. Its exactly : repository 'http://XX.XX.XX.XX/Testsite/mysite.git' not found error.And yes definitely i can ping the server. I am guessing the URL is not correct. – girish Jan 22 '14 at 06:15
  • yes, there's something wrong with the URL then. – gravetii Jan 22 '14 at 06:18
  • yes I am able to ping the server. – girish Jan 22 '14 at 06:20
  • Since it's a linux server, try using ssh: git clone ssh://XX.XX.XX.XX/Testsite/mysite.git – gravetii Jan 22 '14 at 06:23
  • Let me know if that works for you. – gravetii Jan 22 '14 at 06:27
  • It gives a prompt 'Cloning into mysite' and ask for password. But I have not set any password for it. The linux root password doesnot work . Any idea ? .. – girish Jan 22 '14 at 06:40
  • Can you try doing a git clone ssh://@XX.XX.XX.XX/Testsite/mysite.git – gravetii Jan 22 '14 at 06:42
  • mysite.git doesnot appear to be a git repository. Thats the error msg that i receive. – girish Jan 22 '14 at 06:53
  • works perfectly fine now. Although I need to provide password at the prompt while cloning it. However I am guessing I can configure the password like directed by VonC. – girish Jan 22 '14 at 23:07

1 Answers1

0

You can't, without configuring your Apache in order to server git request.

The fact that your mysite.git is within Testsite doesn't make it accessible to git.

As shown in this config, you can define in a separate VirtualHost (so in a separate port, since you are already using port 80/443 on Testing) a config in order to call the git script able to interpret a git clone request:

ScriptAlias /hgit/ /path/to/git/libexec/git-core/git-http-backend/
SetEnv GIT_HTTP_BACKEND "/path/to/git/libexec/git-core/git-http-backend"
<Location /hgit>
   ...
</Location>

As for ssh, the right url would be:

git clone ssh://account@XX.XX.XX.XX/var/www/html/Testsite/mysite.git 

And it would work only if you generate a public and private (non-passhrase protected at first), and publish the public key in the ~account/.ssh/authorized_keys.
Or the sshd (ssh daemon) on the server won't recognize you (hence the password request), and won't know where "Testing/" is.

Community
  • 1
  • 1
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250