0

This whole thing is because i want to have code deployed (and synced) to a live hosting enviromnet, for a website i'm working on (need to actually see the changes i'm doing) - the route being, Bitbucket repo (code being worked on) -> local repo -> HostGator repo (results being visualized).

I'm using Git Bash on Windows. I have a git repository on HostGator in public_html named "test" - configured and everything works fine - i can commit, branch etc. They (HostGator) only allow for a port 2222 on a SSH connection. I've created a local empty repository and then added the remote repository to the remote repository list, like so:

git remote add localName ssh://username@address:2222/public_html/test This is because, try as i might, i can not get SSH to read and apply my local config file.

Then to test that everything works fine i've tried:

git ls-remote ssh://username@address:2222/public_html/test

This connects, asks for a password, and then fails with the message that public_html/test is not a git repository. I've checked permissions, everything's fine.

Question is: why does it fail and not recognize the repository? Is it something in my path, the way i add the remote repo?

EDIT: upon further investigations, even though the directory test is a repository and contains the .git folder, git remote -v shows the end path without the ".git" 'extension' - "public_html/test" as opposed to "public_html/test.git" , second being normal for a repository. This leads me to believe the syntax for adding it is not correct.

Radu Andrei
  • 1,075
  • 10
  • 19
  • Is `public_html/test` a git repository? It's not clear from your question that you've verified that. Is there a `public_html/test/.git` directory in `username`'s home directory (or is `public_html/test` a bare repository)? – larsks Jul 27 '15 at 17:59
  • The folder `test` is, most definitely. `public_html/test` - a path, is not. That's why i'm asking if i'm adding the remote repository wrong. Perhaps git interprets the whole path as the name for the repository, in which case, the question becomes, how do i make it clear to git, i want to add as a remote repo, the `test` folder only - this is an assumption. – Radu Andrei Jul 27 '15 at 18:05
  • Git only operates on entire repositories. The path you supply for the remote in `git remote add` must point to a directory that is either a bare repository, or a directory that contains a `.git` directory. Relative paths (e.g., paths that do not start with `/`) are located inside the target user's home directory. Does that clarify anything? – larsks Jul 27 '15 at 18:10
  • Unfortunately, it does not. The directory `test` is certainly a repository (and it contains the `.git` directory). The problem might be, that git interprets `public_html/test` as a whole name. In which case i'm still stuck on a syntax problem - but again, that's an assumption. – Radu Andrei Jul 27 '15 at 18:24
  • @larsks a little update, to not let things hanging. The guys at HostGator have no idea either, but i managed to circumvent my problem by not going through a local repository. Basically, ssh into my account and from there, `git init` a directory, clone an existing one from say, bitbucket and work with it as one normally would. – Radu Andrei Jul 27 '15 at 23:02

1 Answers1

1

The public_html folder in HostGator is in your HostGator account home directory. See "public_html folder":

http://support.hostgator.com/img/articles/file-manager-home-directory.png

Try and specify the full path:

git remote add localName ssh://username@address:2222/home/username/public_html/test

That being said, it would be best if:

I mean, you can push to a non-bare repo (if the Git on the server is recent enough 2.3+), but the best practice remains a bare repo.

Community
  • 1
  • 1
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
  • I have not checked since i found a workaround, but it would make sense that the issue is the path to my public_html folder. I'll mark this as accepted. Thank you. – Radu Andrei Aug 01 '15 at 20:04