3

Is there some sort of trick to cloning a bitbucket project via SSH so you don't have to manually enter a password each time?

I've tried following their docs and I was able to get to the point where running ssh -T git@bitbucket.org reports success.

My Bitbucket project page reports my SSH URL is:

git@bitbucket.org:myaccount/myproject.git

However, when I run:

git init
git remote add origin ssh://git@bitbucket.org:myaccount/myproject.git
git pull origin master

it fails with the error:

conq: invalid repository syntax.
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

What am I doing wrong?

Cerin
  • 9,652

1 Answers1

7

You are conflating the two Git SSH protocols variants and constructing an invalid URL in the process.

To quote the Git docs on protocol options:

To clone a Git repository over SSH, you can specify ssh:// URL like this:

$ git clone ssh://user@server/project.git

Or you can use the shorter scp-like syntax for the SSH protocol:

$ git clone user@server:project.git

Note that you can't just slap ssh:// on the front of the scp-like syntax, you need to add a forward slash after the hostname (server).

So, with a formal ssh:// URL you need:

git remote add origin ssh://git@bitbucket.org/myaccount/myproject.git

or just use:

git remote add origin git@bitbucket.org:myaccount/myproject.git

For completeness, see Bitbucket's docs on the subject.

wrksprfct
  • 788