How to use Git with Git Hub

Steps to take:

  • Create account in Git Hub. https://github.com/
  • Note down user name, email and password.
  • Down load git from git-scm web site and install it. From here: https://git-scm.com/
  • Open Git Bash in the folder where you wish to download. This could be your eclipse work space folder.
  • Run below commands one after another (type first line and press enter ) and replace the user name and email with your details.

    git config –global user.name “akashdktyagi”

    git config –global user.email “akashdktyagi@gmail.com

    git config –global http.sslVerify false

    git config –global –list   ==> This will display your details

  • Go to the URL: https://github.com/akashdktyagi/CucumberWithSelenium
  • Create your branch by your name. (This will only work once I add you to the repository, for this you need to send me your GitHub user name. I will add it.)
  • Once above config is done, type command: git clone <git path of the repo>
  • “git clone https://github.com/akashdktyagi/CucumberWithSelenium.git”
  • Above command will clone the repo in the folder.
  • Then type command “cd CucumberWithSelenium”. This will switch folder.
  • Then run command, “git checkout Akshay” . Replace “Akshay” with your name. Remember its case sensitive.
  • Once this happens, open your eclipse.
  • Go to File->Import->Existing Maven Project->Navigate to the folder where you have cloned and select CucumberWithSelenium folder->(Pom.xml should be displayed”-> Click on Finish.
  • This will import selenium with cucumber project in your eclipse.
  • Name of the project should display your branch name.
  • Make changes and write code. Once you have done with changes, go to the folder CucumberWithSelenium again and open git bash there.
  • Type command: git status ==> This will tell you all the changes which you have made.
  • Type Command: git add .  ==> This will add all the files
  • Type Command: git commit -m”my changes” ==> this will commit your changes with the message.
  • Type Command: git push ==> this will push your changes on the server. You might have to enter password after this step.
  • Once pushed go to the URL and check if your changes are pushed.
  • For more on Git, read this: https://www.vogella.com/tutorials/Git/article.html

For More Information watch these videos, I recorded earlier. First video is Basic and second one is about Git conflict resolution and Pull Requests, reviews etc.