4

I am trying to clone a repo from Bitbucket on Ubuntu and it fails with:

fatal: https://[email protected]/owner/repo.git/info/refs not valid: is this a git repository?

But if I execute the exact same command on my Mac it works fine.

The command I am using is:

git clone https://[email protected]/owner/repo.git

What could be the issue on Ubuntu?

6
  • Pls add more information on how you are doing the clone i.e the clone command you use . Commented Mar 14, 2016 at 5:07
  • I updated the post with the command Commented Mar 14, 2016 at 5:09
  • Can you access other arbitrary external https sites from this computer? If a proxy or captive portal is redirecting your request, the query would obviously not be reaching a valid Git repo. Commented Mar 14, 2016 at 5:42
  • What are the version of git used in both instances? Commented Mar 14, 2016 at 5:47
  • On the Mac git version 1.7.12.4 (Apple Git-37) On Ubuntu 1.9.1 Commented Mar 14, 2016 at 5:52

2 Answers 2

6

Use the ssh protocol instead of http/https.

Using http/https you will have to type your password every time you have to "talk" to the server.

Using ssh will use the ssh keys and you will not have to type in username password every time.

git clone [email protected]:owner/repo.git

Permission denied (publickey)

You get this error since you don't have ssh keys on any of your platforms. Set the keys, add them to your account and you are all set to go.


Create ssh keys

# create the key pair.
ssh-keygen -t rsa

# echo the key (pub) to the screen and copy it to clipboard
cat ~/.ssh/id_rsa.pub

Add the keys to your bitbucket account

  • Login to your Bitbucket account
    Choose avatar > Settings from the application menu.

  • Choose SSH keys and paste the key you have copied from the first step

enter image description here


Note:

Repeat this step on each machine you need to connect to your account or copy the same keys to all your machines. Both ways will work.

Sign up to request clarification or add additional context in comments.

2 Comments

We got it work with ssh. But I would like to know why it did not work with https.
why http/http did not work? there can be several reasons: cached password, firewall, your server does not support http/https and more. what i'm trying to day that there can be several reasons and it can take a while to figure it out in the ping pong comments :-)
0

I think the command would be either https

git clone https://bitbucket.org/owner/repo.git

or ssh

git clone [email protected]:owner/repo.git

1 Comment

The https clone fails with or without the user name on the command line on Ubuntu and works in both cases on the Mac. And the ssh clone fails on both platforms with `Permission denied (publickey).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.