Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

cloning a private bitbucket repository given access to me

I need to clone a repository from Bitbucket that I was given access to by another user.

I tried this:

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

It gave me an error message: Permission denied(publickey).

How I can clone this repository?

like image 745
ehsanM Avatar asked Jun 09 '15 16:06

ehsanM


People also ask

Can someone clone my private repo?

You also have the option to clone a private GitHub repository using SSH. To do this, you need to start by generating an SSH keypair on your local device. Then add a public key to your GitHub account. This gives you the ability to connect your local device with GibHub using a secure channel over an unsecured network.

Can you clone a Bitbucket repo with read only access?

You can 'clone' the Repository with either Read+Write or Read-Only access: To look at the code and build individual branches, but if you don't need to upload to the repository, choose Read-Only access.

How do I clone a Bitbucket repository without username and password?

One way to clone a repository without having to enter your password would be to create an app-password and use it while cloning. That done, git won't prompt for user name and password. Mind that this is a URL and needs to be encoded as an URL then. This will leave the password in the git configuration.


2 Answers

When cloning a git project you can either use SSH or HTTP protocols. See the documentation:

You can use either secure hypertext transport protocol (HTTPS) or secure shell (SSH) to connect to Bitbucket. HTTPS requires you to enter a username/password each time you connect to the Bitbucket server, for example, when you push your changes. HTTPS is suitable for situations where you work with Bitbucket infrequently and make few code changes. However, if you do most of your coding with a Bitbucket hosted repository, you'll want to set up a SSH connection. After you configure SSH, Bitbucket no longer requires you to authenticate each remote communication with a username/password combination.

When using SSH (as it is in your case) you need to have you public key installed on your BitBucket account. See here for more info. Note that URLs for SSH method start with git@ and not username@.

You can also try to clone it using the HTTP method, which in this case would be like:

git clone http://bitbucket.org:repositoryOwnerUserName/repo.git

This should get you started. However I have not tested it!

like image 178
Yan Foto Avatar answered Oct 21 '22 08:10

Yan Foto


If you are able to access the repository on bitbucket.org, then you sure have access. Go to the repository on bitbucket.org. On the top right side, you will find the HTTP clone link for that repository. Copy that link and in your terminal type:

git clone <link>

You will be asked for your username and password. Once you enter those, the repo will be cloned to your system.

To save yourself from having to type username and password again and again, try this

like image 25
Animesh Sharma Avatar answered Oct 21 '22 09:10

Animesh Sharma