Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR SHELL

how to setup git locally with ssh

# REGISTER github account globally
git config --global user.name <"any name in quotes">
git config --global user.email <github email no quotes>

# NAV to .ssh (unix/powershell)
cd ~/.ssh
cd c:/Users/<user>
  
# CREATE "key"
ssh-keygen -t rsa -C <same email address>
# Press enter twice (optionally create pass).

# PRINT ~.pub contents and COPY or open .ssh file.
ssh-agent sh -c 'ssh-add; ssh-add -L'
# OR
cat ~/.ssh/id_rsa.pub

## ADD key to github.com
# github.com >settings >SSH and GPG keys: Make New: paste.

# CD to git dir (unix/win)
cd /srv  # OR home/git/ (https://serverfault.com/a/761420/956620)
cd c:/Users/<user>/git

# To run git-bash in PS: & 'C:Program FilesGitinsh.exe' --login

# START the ssh-agent (Make "lock")
# Be sure you're in git-bash(win) and in git folder!
# eval `ssh-agent -s` # not working win10
eval $(ssh-agent)

# INSERT "key"
ssh-add ~/.ssh/id_rsa

# ADD github fingerprint to known hosts
ssh-keyscan -t rsa github.com >> ~/.ssh/known_hosts

# CLONE your repo via ssh from github.
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #setup #git #locally #ssh
ADD COMMENT
Topic
Name
7+1 =