# generate public key using Powershell
# email at the end is just a signature that you created it
ssh-keygen -t rsa -b 4096 -C "olegserdia@gmail.com"
# if you see an error: WARNING: UNPROTECTED PRIVATE KEY FILE!
# then cd to a folder with files and run this in PS:
icacls * /reset /t /c /q # https://superuser.com/questions/106181/equivalent-of-chmod-to-change-file-permissions-in-windows
# start the ssh-agent in the background using GIT
eval "$(ssh-agent)"
# using GIT add private key to SSH agent: (PowerShell does not work for some reason)
ssh-add ~/.ssh id_rsa
# add public key to a GitHub repository: Left top corner--> settings
# Clone repository using GIT
git clone git@github.com:Serdia/azure-resume.git
######################################################################
# Troubleshooting
# add Private key to ssh agent using PS
ssh-add C:/Users/oserdyuk/.ssh/id_rsa.pub
#if error: Error loading key "C:/Users/oserdyuk/.ssh/id_rsa.pub": invalid format
# you can either overrite key in a right format: (it changes email to oserdyuk@oserdyuk-vm - not sure why)
ssh-keygen -f C:/Users/oserdyuk/.ssh/id_rsa.pub # click Enter to ignore password
git clone git@github.com:ACloudGuru-Resources/acg-project-azure-resume-starter.git
# to remove keys from SSH agent
ssh-add -D
# service OpenSSH Authentification Agent. Make sure it's running.
C:\WINDOWS\System32\OpenSSH\ssh-agent.exe
# start service in powershell
Start-Service -Name "OpenSSH Authentication Agent"
# start the ssh-agent in the background
eval "$(ssh-agent)"
echo "$(ssh-agent)"
# check whether agent is running or not (GIT)
if ps -p $SSH_AGENT_PID > /dev/null
then
echo "ssh-agent is already running"
# Do something knowing the pid exists, i.e. the process with $PID is running
else
eval `ssh-agent -s`
fi
# list all keys that are present in the agent PS or GIT
ssh-add -l
# overwrite the key. Just please enter (to ignore password)
ssh-keygen -f C:/Users/oserdyuk/.ssh/id_rsa.pub
ssh-add -L # copy the key, place it into GitHub. Worked
ssh-add "C:/Users/oserdyuk/.ssh/id_rsa.pub.pub" -- Error loading key. Invalid format
ssh-add ~/.ssh my_id_rsa