Create a Git Repo through SSH and Cloning it Locally

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.

  • phpstorm and git remote repository
  • git ls-remote fails when logged out
  • How to checkout svn+ssh repository with subgit?
  • Can I link git submodules with some kind of fallback URL? If SSH clone fails, git should be able to clone using https
  • Capistrano deploy with bitbucket - Permission denied (publickey)
  • Git repository working with SSH
  • Gitolite server-side setup for both http and ssh
  • github ssh-agent timeout mediatemple
  • One Solution collect form web for “Create a Git Repo through SSH and Cloning it Locally”

    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


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

    Git Baby is a git and github fan, let's start git clone.