Following instruction help us to generating ssh token and add it to github then working with ssh rather than https.
For more information plase read this blog post : MoreInfo
- Generating a new key with ssh-keygen
- Adding pair private key to ssh-agent with ssh-add
- Adding pair public key to github
- Changing local repo remote address from https to ssh type
-
Generating a new key with ssh-keygen
$ ssh-keygen -t ed25519 -C "your_email@example.com"
- or
ssh-keygen -t rsa -b 4096 -C "your_email@example.com"
- note : MoreInfo
-
Adding pair private key to ssh-agent with ssh-add
ssh-add ~/.ssh/id_ed25519
- note: it adding your private key to ssh-agent that we create in section 1
- note: MoreInfo
-
Adding pair public key to github
- inside your github account following below path
Settings > SSH and GPG keys > New SSH key [button] > Title [input:text] > Past id_ed25519.pub content in to > key [textarea]
- note: to copy id_ed25519.pub content :
cat ~/.ssh/id_ed25519.pub
then copy and passt in to key [textarea] - note: MoreInfo
-
Changing local repo remote address from https to ssh type
- inside local repo type
git remote -v
, this command display remote url that sets for this repo - we must change theas url from https remote :
> origin https://github.com/USERNAME/REPOSITORY.git (fetch)
> origin https://github.com/USERNAME/REPOSITORY.git (push)
- to
> origin git@github.com:USERNAME/REPOSITORY.git (fetch)
> origin git@github.com:USERNAME/REPOSITORY.git (push)
- to change to ssh mode type :
git remote set-url origin git@github.com:USERNAME/REPOSITORY.git
- note : MoreInfo
- inside local repo type