Giter Site home page Giter Site logo

getting-started-with-git-github's Introduction

Image description

ProGrad Labs | Getting started with GIT and GITHUB

In this document, you will find all the steps you should follow when working on git and github (in the prework and during the bootcamp).

Step 1: Steps For Installing Git for Windows

Prerequisites

  • Administrator privileges
  • Access to a command-line
  • Your favorite coding text editor
  • Username and password for the Github

Download Git for Windows

  1. Browse to the official Git website: https://git-scm.com/downloads

  2. Click the download link for Windows and allow the download to complete. Extract and Launch Git Installer

  3. Browse to the download location (or use the download shortcut in your browser). Double-click the file to extract and launch the installer.

  4. Allow the app to make changes to your device by clicking Yes on the User Account Control dialog that opens.

  5. Review the GNU General Public License, and when you’re ready to install, click Next.

  6. The installer will ask you for an installation location. Leave the default, unless you have reason to change it, and click Next.

  7. A component selection screen will appear. Leave the defaults unless you have a specific need to change them and click Next.

  8. The installer will offer to create a start menu folder. Simply click Next.

  9. Select a text editor you’d like to use with Git. Use the drop-down menu to select Notepad++ (or whichever text editor you prefer) and click Next.

  10. This installation step allows you to change the PATH environment. The PATH is the default set of directories included when you run a command from the command line. Leave this on the middle (recommended) selection and click Next.

  11. The next option relates to server certificates. Most users should use the default. If you’re working in an Active Directory environment, you may need to switch to Windows Store certificates. Click Next.

  12. The next selection converts line endings. It is recommended that you leave the default selection. This relates to the way data is formatted and changing this option may cause problems. Click Next.

  13. Choose the terminal emulator you want to use. The default MinTTY is recommended, for its features. Click Next.

  14. The default options are recommended, however this step allows you to decide which extra option you would like to enable. If you use symbolic links, which are like shortcuts for the command line, tick the box. Click Next.

  15. Depending on the version of Git you’re installing, it may offer to install experimental features. At the time this article was written, the option to include interactive options was offered. Unless you are feeling adventurous, leave them unchecked and click Install.

  16. Once the installation is complete, tick the boxes to view the Release Notes or Launch Git Bash, then click Finish.

Step 2: Steps For Installing Git for Linux

Debian/Ubuntu For the latest stable version for your release of Debian/Ubuntu

sudo apt-get install git For Ubuntu, this PPA provides the latest stable upstream Git version

sudo add-apt-repository ppa:git-core/ppa 
sudo apt update
sudo apt install git 

Step 3: Steps For Installing Git for Mac OS

Homebrew Install homebrew if you don't already have it, then:

brew install git 

How to Work with git commands?

Create a new repository

Now, go to your GitHub account, if you don't have an github account create a new one.

Sign in to your existing github account with your login credentails.

  1. Click on the green 'New or +' button to create a new repository.

  2. A new repository page opens. Fill the repository name and click the green 'create repository' button to create a new empty repository.

  3. This is how empty repository will look like.

Create a local repository?

  1. Open the gitbash or windows command terminal or linux or iterm2 in mac.

  1. Open your terminal and navigate to the location where you want to store the local version of your repository.
  2. To navigate use cd command. When you navigated to the correct folder in your terminal, run the following command:
$ mkdir prograd-sample-repo

Check the image below if you have any doubts:

  1. Once the directory is created, to create files In windows shell
echo >> filename 

In linux and mac terminal

touch filename

To check if the file is created

In windows shell

dir

In linux shell or mac terminal

ls 

Configure GitHub Credentials

Configure your local Git installation to use your GitHub credentials by entering the following:

git config ––global user.name “github_username”
git config ––global user.email “email_address”

Run the above commands one by one. Note: Inside the double quotes give your github username and email.

Setting up repository locally

The local repository process is finished with this step. Now we need to initialize the local repository before we proceed to the next step.

$ git init

To open the project in VS Code, you have to run the following command when you already navigated to the folder:

$ code .

If in doubt, check the following image:

Now we are ready to start working/making changes. Quickly go to the terminal and, while in the local repository, run the following command:

$ git status

This shows us that there were no changes made locally, yet.

Step 3: Add, commit and push the changes

After you made changes to your project, you can check which files you changed by running again:

$ git status

How to add changes?

Currently, we demoed making changes to a single file. You might be making changes to one or multiple files; thus, you might see many files marked as modified.

In case you want to add just one file and you are not ready to add the others, you can do so with the following command:

$ git add <name of the file>

However, most likely, you would like to add all the changes so that you will use the following command more often:

$ git add .

👍 The dot represents all files in the current repository.

How to commit changes?

After all changed files are added, you should commit your files and add a commit message describing the things you have changed, with the following command:

$ git commit -m “<your message>

How to add the remote origin?

After committing your changes, you need to add the remote url of your remote repository on GitHub with the following command to push the changes to remote repository.

git remote add origin <remote url>

How to push changes?

After committing your changes, you can push the commits from your local machine to your remote repository on GitHub with the following command:

$ git push -u origin master

Enter the github username and password if it asks.

The final steps will look like

Perfect! The changes we made are now available in the remote repository on our GitHub profile.

That would be it. Happy Coding ProGrad ❤️!

getting-started-with-git-github's People

Contributors

prograd-org avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.