GIT is a online version control system for tracking the changes in files and collaborative development of project among multiple people.
Installation:
Windows users should download the git setup from here.You can opt to use Git from Windows command prompt or use Git bash insted.
For Linux Users:
Debain or Debain based distribution should run following command from terminal:
sudo apt-get install git
Arch Linux or Arch Linux based distribution users :
sudo pacman -S git
Once installation is done open up the Linux terminal or windows cmd/bash terminal.
Run the following command one by one, enter your own Github username and email id in double quotes.
git config --global user.name "user_name"
git config --global user.email "email_id"
Now create a local repository on your system using the command:
git init MyRepo
Now create a files in your repo:
cd MyRepo
vim README
This is my first repository on github.
save this file.
A file named README is generally used to define what the repository actually contains.
Now you can create other files you want.
EG: You have craeted a file named sample.py .
Now run following commands in terminal:
git add README
git add sample.py
You can also add all the files in directory using:
git add --all
Now we can commit the changes made to the files by using the command:
git commit -m "some_message"
Now create a repo on your Github account named MyRepo.
Now run following coammand in terminal.
git remote add origin https://github.com/user_name/MyRepo.git
Now we have to push files in local repository to Github repository.For this use the given command:
git push origin master
Now enter your login credentials as prompted.Make sure your system is connected to internet.If you have followed everything correctly then your repo will be uploaded on Github.
The result will be somewhat like this. |
Comments
Post a Comment