git Tutorial
Introduction 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 IDEASSH keys in git
We can communicate with Git repository using 2 main protocols.- HTTP
- SSH
- 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 keys
Below command is used to create SSH keys.
ssh-keygen -t rsa -b 4096 -C “[email protected]”
Above command creates pair of keys – public (id_rsa.pub) and private (id_rsa) in .ssh directory under your home directory.Registering private key with SSH agent on local machine
Below command will start the SSH agent.
eval “$(ssh-agent -s)”
Below command will register the private ssh key with agent.
ssh-add ~/.ssh/id_rsa
Adding the public key on Git server
You 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
solutions delivered!!