Configure the configuration file for git:
git config --global user.name "YOUR NAME" git config --global user.email "YOUR EMAIL ADDRESS"
I am currently working with my github account and we can work with over HTTPS or SSH.
For connecting over SSH we need to generate ssh keys:
I have been working with windows cmd but it doesn’t support ssh-keygen so I would be switching to git bash.
ssh-keygen -t rsa -b 4096 -C "email@example.com" # Creates a new ssh key, using the provided email as a label Generating public/private rsa key pair. When you're prompted to "Enter a file in which to save the key," press Enter. This accepts the default file location. Enter a file in which to save the key (/Users/you/.ssh/id_rsa): [Press enter] At the prompt, type a secure passphrase. For more information, see "Working with SSH key passphrases". Enter passphrase (empty for no passphrase): [Type a passphrase] Enter same passphrase again: [Type passphrase again]
So after following the above steps we would have generated the keys to be used to connect over SSH. Now we need to add the keys to our account.
Private key needs to be added to the ssh agent.
If you are using Git Bash, turn on ssh-agent: # start the ssh-agent in the background eval "$(ssh-agent -s)" Agent pid 59566 If you are using another terminal prompt, such as Git for Windows, turn on ssh-agent: # start the ssh-agent in the background eval $(ssh-agent -s) Agent pid 59566 Add the ssh key to the ssh-agent $ ssh-add ~/.ssh/id_rsa
Public key needs to be added to the github account
# Copies the contents of the id_rsa.pub file to your clipboard $ clip < ~/.ssh/id_rsa.pub Add the public key to the github account. Github -> Settings -> SSH & GPG keys -> New SSH key -> Fill name of key -> Paste key -> Click Add key
Test the Github connection
ssh -T firstname.lastname@example.org # Attempts to ssh to GitHub If you see your username everything is fine and running
Github post for the above process of connecting over ssh.
Connecting over https we just don’t need to do much, we might have to configure proxy with git config –http.proxy
Some interesting post about git which I have come across Post-1