Skip to content

Instantly share code, notes, and snippets.

@asksven
Created April 2, 2016 20:48
Show Gist options
  • Select an option

  • Save asksven/b37e8d83eca7f77484be9dd7af2b98e6 to your computer and use it in GitHub Desktop.

Select an option

Save asksven/b37e8d83eca7f77484be9dd7af2b98e6 to your computer and use it in GitHub Desktop.

Revisions

  1. asksven created this gist Apr 2, 2016.
    23 changes: 23 additions & 0 deletions git with ssh instead of https
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,23 @@
    If 2fa is enabled on github switch to ssh instead of https on linux

    1. generate an ssh keypair on your linux box
    ssh-keygen -t {rsa|dsa}

    2. add the public key to github: profile - settings - ssh keys

    3. switch from https to ssh

    Check your repo remote:
    git remote -v
    should show:
    origin https://github.com/USERNAME/REPOSITORY.git (fetch)
    origin https://github.com/USERNAME/REPOSITORY.git (push)

    Change the remote:
    git remote set-url origin [email protected]:USERNAME/OTHERREPOSITORY.git

    verify:
    git remote -v
    should show:
    origin [email protected]:USERNAME/OTHERREPOSITORY.git (fetch)
    origin [email protected]:USERNAME/OTHERREPOSITORY.git (push)