Thursday, February 26, 2015

Pushing Up to Github Repo from Ubuntu [Linux]

To be a proficient programmer its mandatory to work with the projects of Github for development (both Project ans self) purpose. For windows, Github provide the application for easier access. But for Linux OS, we need to configure the Git at our pc. We will have to follow some steps for this purpose. We can check he following steps:

Installing Git for Linux

sudo apt-get install git

Configuring GitHub

 git config --global user.name "pronabananda"
 git config --global user.name "paul.pronabananda@gmail.com"

Creating a local repository

Local repository is which project folder we want to connect with the github project folder. For my case, i have created a folder named testproject. And through terminal i am now in the project folder.

Creating a repository on GitHub

Then i have created a repository in GitHub by click and typing. And after confirmation, i have ogt the code which will have be run in the already opened terminal.



- -Generated Code --
echo "# testproject" >> README.md
git init
git add README.md
git commit -m "first commit"
git remote add origin https://github.com/pronabananda/testproject.git
git push -u origin master
- -


Pushing Up local to Github repo:

Following the above code i have run the below code in my terminals to up my local repo. to Github repo:
--
echo "Its a intial testproject" >> README.md
git init
git add .        [ I have added all the files and folder. For this reason I have used . instead of any specific file name]
git commit -m "Initial commit"
git remote add origin https://github.com/pronabananda/testproject.git
git push -u origin master [For the case of first time, it will ask user id and password of Github Account]
--

For adding already existing repo:
git remote add origin https://github.com/pronabananda/testproject.git
git push -u origin master

--------------------------------------------------
If we want to omit some specific type of files and folder for pushing up to Github Repo from the local. For that case we will have to add a file named .gitignore containing the list of files and folder to be skipped. After pushing up the files, if we run the

git log  

it return the full id of the commit. In future for to download the specific state of the project we will have to use this.
----
root@PaulsofTech-WorkStation:/home/paul/workspace/testproject# git log
commit 8b59ac34c30d00a7c4975fadadf6fea52a98515c
Author: pronabananda
Date:   Thu Feb 26 00:51:15 2015 +0600

    Initial commit
---

No comments: