You can change the protocol of you repo from HTTPS to SSH:
Tested on Ubuntu 16.04, 18.04 and 20.04.
ssh-add -l
The agent has no identities
or you don’t see the one you expect, you need to add yours with ssh-add ~/.ssh/identity
/home/<username>/.ssh/identity: No such file or directory
it means you haven’t yet created an SSH key…ssh-keygen
> press “enter” to use the default location > enter and confirm a passwordls ~/.ssh
should now show “id_rsa” and “id_rsa.pub”; these are your private and public key filescat ~/.ssh/id_rsa.pub
in the terminal. Select the text and use Ctrl+Shift+C to copy it (Ctrl+C doesn’t work in the terminal!)cat ~/.ssh/id_rsa.pub | xclip -sel clip
which copies the contents directly to your clipboard, but it does require that you have xclip
installed (this can be done via sudo apt install xclip
)cat ~/.ssh/id_rsa.pub
in the terminal. Select the text and use Ctrl+Shift+C to copy it (Ctrl+C doesn’t work in the terminal!)cat ~/.ssh/id_rsa.pub | xclip -sel clip
which copies the contents directly to your clipboard, but it does require that you have xclip
installed (this can be done via sudo apt install xclip
)ssh -T git@bitbucket.org
ssh-keygen
)logged in as <username>
You can use git or hg to connect to Bitbucket. Shell access is disabled.
git remote -v
to see the names of your remote(s). If the URL starts with “https” we now need to change that.git remote set-url
:git remote set-url origin git@bitbucket.org:<username>/<repo_name>.git
git push --set-upstream origin master
) without needing to enter your username and password
hint: Updates were rejected because the remote contains work that you do not have locally
…it means you need to sync up your local and remote branches: git fetch && git pull
should do that.
git push
ssh -T git@github.com
yes
at the prompt and hit ‘enter’Hi <username>! You've successfully authenticated, but GitHub does not provide shell access.
git remote -v
to see the names of your remote(s). If the URL starts with “https” we now need to change that.git remote set-url
:git remote set-url origin git@github.com:<username>/<repo_name>.git
git push --set-upstream origin master
) without needing to enter your username and password
hint: Updates were rejected because the remote contains work that you do not have locally
…it means you need to sync up your local and remote branches: git fetch && git pull
should do that.
git push
ssh-agent -s
ssh-add
git push <remote_name> <branch_name>
(although git push
should also work) ssh-keygen
. Hit ‘Enter’ to select the default location (C:\<username>.ssh) then respond with ‘y’ to confirm. Enter your passphrase twice (use your Git password). This creates “id_rsa” and “id_rsa.pub” in C:\<username>.ssh - these are your private and public keys, respectively.ssh-agent
ssh-add C:/Users/<username>/.ssh/id_rsa
ssh -T git@bitbucket.org
. You should get something like the following message:conq: logged in as emmap1.
You can use git or hg to connect to Bitbucket. Shell access is disabled.