What is the proper and simplest way (hopefully a How To Guide) to connect via SSH to the git?
Asked by capuromeyer:

Hello,

Hopefully someone can point me to the right documentation on this matter.

I'm getting this emails saying there will no longer be able to use password.

What is the proper and simplest way (hopefully a How To Guide) to connect via SSH from an own server to the git at bitbucket using other method other than password?


Answers:
author: Caroline R
body: Hi, [@capuromeyer](/t5/user/viewprofilepage/user-id/2296935), thank you for reaching out to Atlassian Community.

Just to complement Robert's answer, in order to change your authentication method in Git, you can change the remote URL of your repository (you can switch it to SSH/HTTPS). In order to modify that, you can run the following commands:

1. From a terminal, navigate to the repository:

```
$ cd ~/<path_to_repo>
```

2. Run **git remote -v** to see the current remote URL:

```
$ git remote -v
origin https://emmap1@bitbucket.org/tutorials/tutorials.git.bitbucket.org.git (fetch)
origin https://emmap1@bitbucket.org/tutorials/tutorials.git.bitbucket.org.git (push)
```

3. Update the remote URL with **git remote set-url** using the current and new remote URLs.

```
$ git remote set-url origin git@bitbucket.org:{workspaceID}/{repository_name}.git
```

In case you would like to read more about how to change the remote URL of your repository, you can access the following page:

* <https://support.atlassian.com/bitbucket-cloud/docs/change-the-remote-url-to-your-repository/>

And if you need any help to configure an SSH key, you can find more information here:

* <https://support.atlassian.com/bitbucket-cloud/docs/set-up-an-ssh-key/>

I hope this helps, but do let me know if you have any questions.

Kind regards,  
Caroline


author: Robert Wen_ReleaseTEAM_
body: Are you talking about setting up an SSH key? Here is the documentation for how to do that .

<https://support.atlassian.com/bitbucket-cloud/docs/set-up-an-ssh-key/>

comments: author: capuromeyer
body: Hi thanks for replying

Actually, I'm talking about command line push/pull to a repository at Bitbucket.

I will try to explain myself further.

Let's say we have a simple web project within an Bitbucket's private repository. All development changes are made at development/staging servers after being ready we push changes via Git to Bitbucket; then from a production server via Git we pull those changes to live production.

Working on Ubuntu environment, we use:  

git push origin production (development --\> Bitbucket)  
git pull (Bitbucket --\> production)

when using the above, the command line asks for a password \[bitbucket user password\] and all is done, I understand it will no longer be possible to do it by a password.

I don't know how to do the above by other methods; as passwords will be deprecated I'm forced to learn a new way, hence my question.

What is the easiest/simple way to do it?


author: Robert Wen_ReleaseTEAM_
body: If you're talking about personal account passwords going away, this [deprecation notice](https://bitbucket.org/blog/deprecating-atlassian-account-password-for-bitbucket-api-and-git-activity) specifies this affects connecting to the Bitbucket API and using git over HTTPS. SSH doesn't appear to be affected.

Since it appears you're talking about using git over SSH, the original link I supplied does apply. That's what I use to connect between my local repo and Bitbucket.

Hope this helps.


author: capuromeyer
body: Hi, thanks for replying.

I'm a little confused by now.

When cloning a repository into a server I use:

git clone <https://bitbucket.org/team/repository.git> /path/to/directory

I believe I'm connecting through HTTPS

Will this be affected?


author: Robert Wen_ReleaseTEAM_
body: You're connecting over HTTPS. Connecting over SSH would look like:

```
git clone git@bitbucket.org:team/repository.git /path/to/directory
```


Tags: bitbucket-cloud

cloud