GitHub

How to install Github ?

Open terminal –>type –> sudo apt install git—>enter your laptop password–> git will be installed

What is GitHub?

GitHub is a website and cloud-based service that helps developers store and manage their code, as well as track and control changes to their code. To understand exactly what GitHub is, you need to know two connected principles:

  • Version control
  • Git

GitHub is a code hosting platform for collaboration and version control.

GitHub lets you (and others) work together on projects.

Version control:

Version control helps developers track and manage changes to a software project’s code. As a software project grows, version control becomes essential.

version control lets developers safely work through branching and merging.(tbd)

With branching, a developer duplicates part of the source code (called the repository). The developer can then safely make changes to that part of the code without affecting the rest of the project.

Then, once the developer gets his or her part of the code working properly, he or she can merge that code back into the main source code to make it official.

All of these changes are then tracked and can be reverted if need be.

Version control software keeps track of every modification to the code in a special kind of database. If a mistake is made, developers can turn back the clock and compare earlier versions of the code to help fix the mistake while minimizing disruption to all team members.

Git

Git is open source created by Linus Torvalds.

Git is a distributed version control system, which means that the entire codebase and history is available on every developer’s computer, which allows for easy branching and merging.

According to a Stack overflow developer survey over 87% of developers use Git.

GitHub.com is not open source(it is a website) –>Microsoft acquired its larger rival GitHub in 2018 for $7.5 billion, which at the time was a high-priced deal in subscription software.

GitHub —>projects—>Repository(this is were we keep the program.) here the team lead can edit, accept and add,comment. here when it is edited will be shown.

public repositories —> we can have our code open source

87% developers use GitHub.

github uploading projects

  • Create a folder in any location(Documents) and name it(I named it as project
  • open terminal and copy the location of that folder.
  • To show that it is the git repository we should Type: git init in terminal.
  • Now a hidden folder will be created in project folder. To see that folder –>Right click–> show hidden file. We can find .git folder.
  • From this folder we are going to share the programs in GitHub.
  • Now give the email id and user name of your GitHub account by giving the command in terminal

git config –global user.email “sandhiyasandeepapun1999@gmail.com”
git config –global user.name “SandhiyaMahe05”

  • Paste the program folder which we want to upload in git in Project folder.
  • Now we are going to add and save the program to github

Command line to add: git add Mobile.java
Command line to save: git commit -m “Updated my code”

  • Open the GitHub click on + symbol next to profile–> select new repository. Then give name for the project(Project 1) and select create repository.
  • After that copy the link in HTTPS paste that in command line

Command line: git remote add origin https://github.com/SandhiyaMahe05/Project-1.git

  • Now we are going to push the content in local to origin

command line: git push -u origin master

  • We need to give our user name and password for this
  • password is personal access token link. so we have to create a personal access token–> two way authentication.
  • how to create personal access token https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/creating-a-personal-access-token
  • creating personal access token–> profile right down arrow–>setting–>select <> Developer settings–> select Personal access tokens—> click on generate new token–> write the note, Expiration(90 days or no expiration), check and select repo–> click on generate token.
  • Now copy and paste the token in password in terminal(We can not able to see the token in terminal) and enter.
  • To check the edited code. give command: git pull

References:

https://www.w3schools.com/whatis/whatis_github.asp https://www.atlassian.com/git/tutorials/what-is-version-control https://kinsta.com/knowledgebase/what-is-github/

Leave a comment

Design a site like this with WordPress.com
Get started