This tutorial video demonstrates how to create a repository from a local(computer) to a remote system(Github). Now we see a few concepts of git.

Why git is required?

If you working on a project, your files are changed frequently. After some days you need to recover the old code. In that scenario, you feel difficult to track that change to be hard. So that reason we create a version control to track every change easily in git.

In this tutorial, I explained how to create a repository from a local(computer system) to a remote system(eg: our server, GitLab, Github, etc)

In this example I used WordPress and GitHub , these steps can be useful for any projects

Steps

  • Create a git repository in the cloud such as Github
  • Go to Github.com
  • create a repository in GitHub.com
  • After creating a repository
  • In the computer system, create a folder eg: backed-universal
  • Go to the folder backed-universal
  • Enter Command

git init
  • This command initializes a git repository on local. Internally this command creates a .git folder in local
  • Next Enter second command
git add .
  • This command stages all files, which means all file changes are ready to add-in git.
git commit -m "firstcommit"
  • This command ready to commit all changes, which means all files you already change, but you need to tell the message why its changes
git remote add origin url
  • This command adds the remote repo to local, which means you don’t know which repository need to push or upload these files, this command tells github.com repository, first time only give this command, and next give credentials username and password
git push -u origin branchcname

This command pushed or upload all files to your branch, For Further explanation see the below video