Wednesday 19 November 2014

Looking To Create Your First GitHub Project? Here Are The Basics!

If you're a developer, you won't need any introduction to GitHub. Time and again, the much popular code-hosting website has come to the rescue of those looking to develop software in an open, collaborative environment. However, that's not what GitHub is only all about. It gives other developers a chance to look into and interact with your project and make necessary updates to it from time time, wonderful, right? However, beginners might find GitHub a little confusing to begin with. Don't worry, we are here to help as always!

GitHub, Git, Developer, hosting service, GitHub account, README file, Commits, local repository




1.Getting accustomed to the workflow

Ok, let's start right at the beginning. What really is GitHub? According to Wikipedia, GitHub is a Git repository web-based hosting service which offers all of the functionality of Git as well as adding many of its own features. Yes, GitHub and Git are two different entities! Basically, you'll need to download the Git version control system first to get started with GitHub. You'll then be required to create two repositories, one on the GitHub website, the other on your local computer. Once you're done, you'll be working on your project in your local repository and committing your work to its corresponding GitHub repository from time to time. The two repositories communicate via Git.

2.Installing Git

You can download Git here. Just so you don't waste your time while the download is happening, you can create your own GitHub Account (in case you don't have one already).

Set up (on Mac):

-Open your Mac's Terminal program and enter the following:

git config -- global user.name "Name" followed by:

git config -- global user.email "abc@example.com"

3.Proceed to create your first repository

-Log into your GitHub account and select 'New Repository'. Name it and add a description. Make your repository public (if you're looking for others to view and contribute to it in true open source style). Add license to your project.

-Select 'Initialise this repository' and GitHub will automatically generate an empty README file where you can enter some text.

4.Creating & Committing a README file manually

-Create a local code repository (a folder where you'll store your project). Let's name it XYZRepo for instance. You'll then need to change the default directory from the Terminal so all action is now directed towards XYZRepo. You won't need to type its full path everytime you give a command from thereon.

-Now, create a .git subdirectory to change XYZRepo into a local repository. This will now contain all your repository's metadata. All you need to do is run the command:

git init

-Now you need to tell your local repository about its GitHub equivalent. Here's how you can do this:

git remote add origin https://github.com/your_username/repo_name.git

-Now create your README file:

touch README.md

A new README.md file will appear in your XYZRepo.

-To stage the README file (pick and choose which files to go to GitHub):

git add README.md

-Now send your commit to the GitHub repository (master branch):

git push -u origin master

Source: Developer.com

No comments:

Post a Comment

Related Posts Plugin for WordPress, Blogger...