How to use GIT to publish project / source code to github

Git is a very good tool that allows you to publish your project or source code to the github web repository. It allows others to view your code / project and make changes, with one of the best version control systems around.

I will use the MumbaiStock project on github as an example to illustrate the git commands. Open a terminal window in Linux to get started.

First install git on your local computer by:
$ sudo apt-get install git <enter>

Next set up your project on the github site. Visit https://github.com and register and set up your project. Give it a name. In my case, I gave my project the name of MumbaiStock.

Now on your local computer, set up git.
$ git config --global user.name "User Name" <enter>
This will set up a global user name for your git project. user.name should be your name.

$ git config --global user.email "user@email.com" <enter>
This will set up an email address. user.email should be your name.

$ git config --list <enter>
This displays the configuration settings.

$ git init <enter>
Initializes git on the desktop

Now create a folder on your local desktop called MumbaiStock.
$ mkdir MumbaiStock <enter>

Clone from the github server to your local MumbaiStock folder
$ git clone git://github.com/user/Mumbai.git <enter>
This is required for the first time after you set up your project on github. user = your user id on github. For MumbaiStock this is geetuvaswani.

Copy the code files into the local MumbaiStock folder where you created the git repository.

Commit code to the git repository with
$ git commit MumbaiStock.pm Quote.pm LICENSE -m v1.0 <enter>

Synchronize the code to the github repository using
$ git remote set-url origin https://github.com/user/MumbaiStock <enter>

See the URLs
$ git remote -v <enter>

Pull code changes from the github web site to your local MumbaiStock folder
$ git pull <enter>

Push the code changes from your local MumbaiStock folder to the github web site using
$ git push <enter>

I needed to figure this out because I had to post a new module to the Finance::Quotes of Gnucash. Therefore, I made a perl module (code) and put it up on github for others to use, modify or improvise.

Leave a Reply

  

  

  

Blue Captcha Image
Refresh

*

September 2019
M T W T F S S
« Aug    
 1
2345678
9101112131415
16171819202122
23242526272829
30