Can't git fetch through SSH

I’ve setup a git repository one a remote server. Now I’m trying to checkout from it with:

git fetch ssh://username@url.com/~username/workfolder/

but I get an error:

  • Setting up post-receive hook for bare repo
  • git: replace folder with the same folder on a different branch
  • How to organise git repos when building on a seed project
  • How can I make Jenkins only build feature branches if they have changed when triggering from bitbucket
  • Keep settings in branch
  • git unable to find certificate in keychain after updating to macOS Sierra
  • fatal: Not a git repository
    

    What am I doing wrong? Could it be the server does not support Git+SSH?

  • How to remove a ssh key?
  • How to resume Git-Flow after a break cause by a merge conflict on a finish command?
  • Github - Commit error after renaming package in android application: LibGit2Sharp.LockedFileException: The index is locked
  • How to define ESC char in git?
  • How to fix git error broken link from tree to tree?
  • Git lines getting deleted without notice
  • 3 Solutions collect form web for “Can't git fetch through SSH”

    Try

    git clone ssh://username@url.com/~username/workfolder/
    

    Which will create the repository on your local machine. Any commits you make to that branch are to your local repository, and when you want to push back up to the remote server you can run:

    git push ssh://username@url.com/~username/workfolder/
    

    git fetch fails because it expects to be run from within an existing git repository. As Andy Hume notes, you must first git clone to create a local copy of an existing repo.

    Further, it defines a git remote called origin which is set to the URL that you cloned from. This is the default remote used when you type git fetch or git pull to retrieve new commits into your local repository, and the default destination when you git push to push your new local commits out to a remote repository. You do not need to include ssh://username@url.com/~username/workfolder/ in your push command if that is where you cloned from.

    Here are some other useful references, from http://gitready.com/:

    • Pushing and pulling
    • Push only to bare repositories

    Could be the tilde ~
    Try: ssh://username@url.com/username/workfolder

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