Moving a project to Git

Until now, whatever we have coded resides locally on our machine, which will never be an ideal case as we will typically be using the source control tool GitHub, Bitbucket, and so on. Follow the given steps to move the project to GitHub (assuming that you have a GitHub account; if not, please sign up on https://github.com/):

  1. Install Git by downloading the respective installer for your machine (either Mac or Windows).
  2. Once done, launch the Terminal and type in the git --version command. It should show something similar to this (with a higher version number):
  1. The next step is to configure your git username and email using the following commands:
      $ git config --global user.name "firstname lastname" 
$ git config --global user.email "[email protected]"

Once the preceding steps are executed, we are done with the setup of Git; the next step is to move the repository to Git. Follow these steps for that:

  1. Log in to Git and click on New repository. You will be directed to another window, as shown:

  1. Enter a Repository Name.
  2. Enter the Description for your repository.
  3. By default, Public repository will be selected. Choose Private if you want to set up a private repo.
  4. Click on Create repository.

Once done you will see this screen:

So, now we have an existing project that we want to get started with. Let's follow these steps to push the HelloAppium project to GitHub:

  1. Launch the Terminal (the Command Prompt on Windows) and navigate to the HelloAppium project folder.
  2. Type git init, and you will see this output:
  1. Once done, run the git remote add origin https://github.com/nishantverma/HelloAppium.git command to add the remote origin.
  2. Do a git add for all files, as shown:
      git add --all
  1. Do a commit with the "Initial Commit" message:
      git commit -m "Initial Commit"
  1. Once done, it will show a bunch of files that are ready to be pushed.
  2. Run the push command:
      git push -u origin master
  1. This is a snapshot of all the commands and the typical output:

We have pushed our project to GitHub with the preceding steps. The next job is to create the Jenkins task that will use this repo to run the Appium test.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.216.171.107