Issue
I have looked up other questions but do not get the same results the answers have provided.
I initially had my DigitalOcean droplet backed up with a github repo using https.
I have followed all of the instructions (multiple times) at https://docs.github.com/en/github/authenticating-to-github/connecting-to-github-with-ssh/about-ssh
I have deleted the old .git folder. I have updated the ~/.ssh/config file according to: How to permanently add a private key with ssh-add on Ubuntu?
Everytime I push or 'git push --set-upstream origin main' I get the option to input my username and password and then get rejected for using https.
I have also updated my ~/.ssh/config file to:
HostName github.com
User git
IdentityFile ~/.ssh/yourPrivateKeyName
IdentitiesOnly yes
Solution
To move from https to ssh, you just need a
# replace <your-name> and <your-repo> with the real values.
git remote set-url origin [email protected]:<your-name>/<your-repo>.git
However, to make it easy, you can just clone a new local repo.
Just type
# replace <your-name> and <your-repo> with the real values.
git clone [email protected]:<your-name>/<your-repo>.git my-new-local-repo
Answered By - banyudu Answer Checked By - Pedro (WPSolving Volunteer)