2

I have a website on a shared host which support git. Working with FTP is getting too difficult so I am planning to use git in my workflow. I just know basic push, pull, commit commands. I would like to set-up git but not being able to work it out. Here is what I tried till now.

ssh user@host
cd ~/mysitedirectory/html
git init

and it says git repo initialised. On my local computer, I did this

cd my/local/path
git init
git remote add origin ssh://user@host:/chroot/somedir/mysiteditectory/html/.git
git pull origin master

And it asks for password, which I provide. Then it throws following error.

fatal: Couldn't find remote ref master *-iMac:PB_Source *$ fatal: The remote end hung up unexpectedly

I am trying it from last 2-3 hours. Can't find solution. Please guide me what am I doing wrong.

JB Nizet
  • 678,734
  • 91
  • 1,224
  • 1,255
Ryan
  • 21
  • 2
  • 2
    Not sure if this is the issue, but usually with this setup you'd have a bare repository located on your server, outside the web root created with git init --bare. The git homepage has a good book with instructions about this. – Matt Browne Jul 15 '15 at 02:41
  • Possible duplicate of [git pull displays "fatal: Couldn't find remote ref refs/heads/xxxx" and hangs up](http://stackoverflow.com/questions/6930147/git-pull-displays-fatal-couldnt-find-remote-ref-refs-heads-xxxx-and-hangs-up) – Code-Apprentice May 10 '17 at 00:45
  • I suggest using `git clone` instead of this longer sequence of commands. – Code-Apprentice May 10 '17 at 00:46

1 Answers1

1

In a similar situation I found that removing the slash at the beggining of the path, solved the issue. But the syntax was not the same. When using the colon you do not add ssh:// I'd say, so:

git remote add origin user@host:chroot/somedir/mysiteditectory/html/.git

OR

git remote add origin ssh://user@host/chroot/somedir/mysitedirectory/html/.git

HDJEMAI
  • 9,436
  • 46
  • 67
  • 93
Jaume Mal
  • 546
  • 5
  • 21