GitHub
GitHub is a web-based hosting service for version control using Git. Mostly used for computer code.
Its provides distributed version control and source code management as well as adding its own features.
It provides task management for the projects.
GitHub provides private repository and free accounts which help to host open source software projects.
Installing Git for Linux
sudo apt-get install git
Configuring GitHub
After the installation is completed, next step is to setup the configuration details of the user.
git config --global user.name "user_name"
git config --global user.email "email_id"
Creating a local repository
We should create a folder in our system. This serves as local repository and this will be pushed up later onto GitHub website.
git init html
If the repository is successfully created, you will get a line like this:
Intialized empty Git repository in/home/uki4/html/.git/
Here the html file which is created and "init" makes the folder as GitHub repository.
Change directory to this newly created folder.
cd html
Adding repository to files to an index
This is very important step. We add all the things which we need to push it onto website into an index.
So now we have a file index.html file.
we can add it to index by using 2 commands:
git add index.html
git add */. ( to add all files )
Commiting changes made to the index
After all files are added, we can commit them. Now they are ready to be uploaded in our repository. The command used for it is:
git commit -m "some message"
Creating a repository in GitHub
While creating a repository in GitHub, we should create the folder name as same as we created in local repository.
Once we finished creating, we can push the contents of local repository into the GitHub repository in your profile. For getting connected with the repository in GitHub the command is:
git remote add origin https://github.com/user_name/html.git
Pushing files in local repository in GitHub repository
The last step is to push the local repository contents into the remote host repository (GitHub).Using command:
git push -u origin master

Enter the user name and password.
To clone an existing repository
If u want to working copy of your repository on another machine
git clone https://github.com/user_name/repo_name.git
To pull changes from GitHub repository
git pull


No comments