GitHub is a Git repository(repository, in short, is termed as a repo) hosting service platform allowing us to store our local repositories and share it with others for collaboration.
Github is home to 28 million active developers and 85 million repositories.
GitHub makes it a lot easier for individuals and teams to use Git for version control and collaboration. GitHub repositories are open for all making the other developers collaborate.
GitHub is free to use for public and open-source projects. On January 7, 2019, GitHub announced
Public repositories can be seen and cloned by anyone. But no one can change or alter source repositories(called master branch) unless we provide them special permission to do so. So, there is nothing to worry as it is completely safe.
One thing that beginners tend to get confused is Git vs GitHub?
Git is a self-sufficient tool to manage source code revision history and GitHub is a hosting service for Git repositories.
We can use Git to manage our project revisions without using GitHub. But if we want to share the project with our team or to make it publically available for fellow developers, we host it to an online service provider like GitHub or Bitbucket.
How do I use GitHub?
GitHub is user-friendly and very easy to get started with. All we need to understand the terms like fork, clone, pull requests, etc.
Now we will create our very first repository on GitHub.
- navigate to + icon and select New Repository option -
It will open a new page asking about repository information like Repository name, description and whether we want to make our project private or public, etc.
Fill the information and click Create repository button. Now we have successfully created our first repository on GitHub.
Neat. As we can see we have our first repository on GitHub ready to grow as we work.
Now we will clone the remote repository to our local system. This is because we will be working on our local repository and pushing the change to GitHub repository very frequently.
Navigate to the Github and click on Clone or Download button. It will open a dropdown with our remote repository address.
Navigate to the location where you want to clone the repo. Right click and select -> Git Bash option
The commit message is written in quotes. This message will be saved with the particular revision we did.
Great. So far, we have created a repository on GitHub, set up Git tool, cloned it on our local system, made changes, added changes to the staging area and committed those changes.
But our local changes are yet to be pushed to our remote repository.
Step 8: Push changes to the remote
It is time to push these changes to the server. To push the changes to remote -
git push
That is all. We have successfully pushed all our local changes to our remote repository. If we goto our remote repository which we created, we can see that change we made has been updated on GitHub.
So, now our basic work-flow is, every time we make any changes(modification, adding new files or deleting unused ones) to the local repository -
stage changes (git add .)
commit changes (git commit -m "Commit message")
push to remote (git push)
Note that, it is must to commit changes before pushing it to the remote server.
Let's add a few files to our local repository. (Video)
- a homepage: index.html having
- a navbar, footer, and styling: style.css
Open the project directory with your favorite code editor( I am using