How to pull master branch from bitbucket

Posted October 28, 2016 12.6k views

I know just enough about git to commit / push, but can’t seem to get it to download to DO so I can actually host my project.

I am trying to download from mt git repository. I use bitbucket. I’ve tried every variation og git pull and git clone using my url from bitbucket

remote: not found
fatal: repository ’’ not found
Permission denied (publickey)

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Submit an Answer
1 answer

Make sure everything is setup correctly on Droplet.

Bitbucket offers you to copy whole command and just execute it. Make sure you do it, so you don’t make typo anywhere.

Looking by Permission denied (publickey), you should have id_rsa and in Droplets /home/your-user/.ssh. That same publickey must be specified in Bitbucket settings.
I think you need to copy manually using scp or rsync.
First make sure you even have .ssh directory in your home folder on Droplet.
Then exit SSH, and from your local machine use scp/rsync to copy keys:

  • scp ~/.ssh/id_rsa your-user@droplet-ip:~/.ssh/
  • scp ~/.ssh/ your-user@droplet-ip:~/.ssh/

Login again to the Droplet and try to clone again.

You can also use HTTPS link, as it doesn’t require you publickey. You should have on Bitbucket option to change between SSH and HTTPS link.

  • Thank you for your help. I was able to get it to work once I started using putty instead of the web based console to connect. The web one is terrible in every way.

    I even got my files to download, but they are all inside a folder with my project name, but I think i want them all on the root, that’s how I have it on c9. Do you have any idea what step would have caused this or how to do it right?

    • This is right behavior. By default git clone will create new folder with project name and download files there.
      Part of man git clone saying above:

      man git clone
      Clones a repository into a newly created directory, creates remote-tracking branches for each branch in the cloned repository (visible using git branch -r), and
             creates and checks out an initial branch that is forked from the cloned repository’s currently active branch.

      There is way you can clone in current directory by this command:

      • git clone url .

      The . on end of command specifies current folder as clone location.

      • I got an error saying I couldn’t clone to a folder that’s not empty.

        I found

        git remote add -t \* -f origin <repository-url>

        and that seems to have worked, though I’m not really sure what the difference is.

        • Glad to see you got it working. :)
          This could be due to some Bitbucket specific things. On GitHub, I got it working flawless. Anyways, if you get some new problem and question, ask, I or someone other will try to help you. :)