0

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
thad_php
  • 13
  • 1
  • 5
  • 5
    Did you change the remote URL to use SSH instead of HTTPS? Doesn't sound like you did – fredrik Sep 14 '21 at 20:36
  • 1
    Git repositories are not a good way to do backups, and GitHub is not going to appreciate you using their service for backups. You'd be better off using a real backup solution (e.g., bup or Tarsnap) that is designed to do backups in an efficient way. – bk2204 Sep 14 '21 at 21:37

1 Answers1

0

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 git@github.com:<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 git@github.com:<your-name>/<your-repo>.git my-new-local-repo

enter image description here

banyudu
  • 1,046
  • 9
  • 19