Creating repository at GitHub

STEP 1 : You need to have an account at github.com to create a repository.Definitely you also need git to be installed on your local machine.

STEP 2 : It’s time to go on command line.

git config --global user.name "Your Name Here"

Of course, you’ll need to replace “Your Name Here” with your own name in quotations. It can be your legal name, your online handle, anything. Git doesn’t care, it just needs to know to whom to credit commits and future projects.

Next, tell it your email and make sure it’s the same email you used when you signed up for a GitHub.com account just a moment ago. Do it like this:

git config --global user.email "your_email@youremail.com"

STEP 3 : Create your online repository.

Go back to github.com and then on create repository page.Give your repository a short and memorable name.Now that you have created a repo , lets now add our local directory to repository.

STEP 4 : Initialize git.

On your local system in command prompt follow below steps.

mkdir gitproject

cd gitproject

git init

STEP 5 : Commit with git

Suppose we are inside gitproject directory where we last left off.Follow below steps.

touch readme.txt

You may then see the status with git status command.This will display output which says readme file as untracked.To make it noticed to got we need to add it.

Use git add readme.txt to add file.Hooray we added our first file, so its time to commit.

git commit -m “Add readme.txt” .Here m stands for any message attached with the commit.

STEP 6 : Connect your local repository to github repository.

We need to tell git that our repository exists somewhere online.

git remote add origin https://github.com/username/gitproject.git

To confirm type : git remote -v

STEP 7 : Push Data

Now we want to upload, or “push,” our changes up to the GitHub remote repo. That’s easy. Just type:

git push
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s