git TutorialIntroduction Installing Git Understanding Git architecture Initializing the new Git respository Cloning new Git repository .git directory in Git repository Viewing Git configuration First time Git configuration Using SSH keys with Git Checking Git status Adding files into staging area in Git Committing changes to the local repository Ignoring files using .gitignore Viewing the history of commits Viewing the file contents in working directory, staging area and repository Viewing difference between files Viewing the history of files Git revert Git Reset git reflog Creating and switching to new branches in Git Viewing existing branches Merging branches Resolving conflicts Rebase Deleting branches Renaming the branch in Git Push Pull Stashing the changes in Git Tags in Git Patches in Git Creating new repository on GitHub Pushing local repository to remote repository like GitHub IntelliJ IDEA
SSH keys in gitWe can communicate with Git repository using 2 main protocols.
- Create pair of public and private keys using ssh-keygen command
- Add private key to the SSH agent running on local machine
- Add public key on the Git server like Stash or GitHub.
Generating SSH keysBelow command is used to create SSH keys.
Above command creates pair of keys – public (id_rsa.pub) and private (id_rsa) in .ssh directory under your home directory.
ssh-keygen -t rsa -b 4096 -C “[email protected]”
Registering private key with SSH agent on local machineBelow command will start the SSH agent.
Below command will register the private ssh key with agent.
eval “$(ssh-agent -s)”
Adding the public key on Git serverYou have to copy the public key from the id_rsa.pub file and paste it on the server SSH key section. Below image shows sample key added on GitHub.
Web development and Automation testing