I cloned my company project repo using HTTPS, I want to migrate into SSH because it conflicts with my personal git account. how can I migrate into SSH instead of using HTTPS?
Steps
$ ssh-keygen -t rsa -b 4096 -C "[email protected]"
Enter passcode and then copy it pbcopy < ~/.ssh/id_rsa.pub
If you don't have pbcopy, xclip or vim just type: cat ~/.ssh/id_rsa.pub
add it into your GitHub Adding a new SSH key to your GitHub account
remove GitHub credentials (if u were using HTTPS there is a high possibility GitHub credentials are saved in your system), we don't need those credentials since we are using SSH (Optional step)
Change the remote URL to SSH
>git remote set-url origin <SSH url>
example : git remote set-url origin [email protected]:username/repo_name.git
Enter the passKey
Verify your remote url has been changed git remote -v
You need to generate ssh key, add it to your profile and then change the url
Source: https://help.github.com/en/enterprise/2.15/user/articles/adding-a-new-ssh-key-to-your-github-account
ssh-keygen
and follow the on-screen messages (or simply click Enter till it over)Copy the key file (the content of the public key) located in:
~/.ssh/id_rsa.pub
In the upper-right corner of any page, click your profile photo, then click Settings.
In the user settings sidebar, click SSH and GPG keys.
Click New SSH key or Add SSH key.
Paste your key into the "Key" field.
Click Add SSH key.
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