How to submit code to Github

First of all you need to create a free Github account, and also you need to check if git is installed. Open a terminal window and type:

git –version

If git is not installed, then go to the git download page and install the appropriate version for your operative system, or just type:

sudo apt-get install git

Then you need to configure your local git profile, just by typing in the terminal:

git config –global user.name “myname”

git config –global user.email “myemail”

And of course you should replace the text beneath the quotes with your own name and email.

And now go to Github and click on the button that says “New repository”, give it a name and click on “Create Repository”.

Noew that your repository is online, go to the terminal and go to the root folder of your project, then type:

git init

This will create an empty local repository.

See if there’s a README.md file in the root folder of your project, if not, create one, you can leave it blank if you want to, this file is the description and other important information about your project that appears in the repository page.

And now you have to add all your files to the queue so that they can be commited:

git add .

git commit -m “some random message”

Now in order to push the code to your repository, you need to create a connection to it, just type this and change the link to fit the one of your repository (you can see it in your repository page), where “bazinga” is the remote name:

git remote add bazinga https://github.com/username/repo-name.git

So now all you need to do is to push the commit to your remote repository with:

git push -u bazinga master

This adds your commit to the master branch.

And that’s all! you should now see your all your project files in the Github repository.

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 )

Google+ photo

You are commenting using your Google+ 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 )

w

Connecting to %s