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?
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.
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.
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.
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!
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With