Posted in Programming

Get yourself a Git!!

Ok, we have the project and now we need to make it ready to version it and then, no more headaches. If you don’t have a project, create one following thise simple steps. So let’s start.

The first thing you need is to have an account on GitHub. It’s very easy, no problems: GitHub Account.

And following with the easy part, on the right top there is the plus button.

GitHub start page
GitHub start page

The plus button is a fast lane to add a new Repository or a new Organization. We want the new Repository, of course.

New Repository GitHub
New Repository GitHub

And after that…

Creating a New Repository on GitHub
Creating a New Repository on GitHub

We just need to set our repository details, I mean data as the name of the repository ( actually the name of the project) and a description. The user has to chose if it is a private account or a public. GitHub is an open source network, and encourages you to always make it public in a very effective way: billing the private projects. That means you have to have a paid account to have a private project. That’s why mine is public 😉

And just hit Create Repository, no secrets, no changes at the rest of the settings. What will lead you to this screen:

GitHub New Empty Repository
GitHub New Empty Repository

Quite creepy, isn’t it?

Yeah! but this is only GitHub telling what you’re supposed to do, in our case, with Terminal on our Mac. That means the GitHub part is practically over.

Let’s head to the Terminal and navigate with ls and cd to your workspace (for mac users: alt/option + tab helps to fill the folder name, but beware of the capitals)

Navigate to your project
Navigate to your project

ok, looking back to the last git string, it shows us a interesting (creepy) code:

echo "# AppName" >>
git init
git add
git commit -m "first commit"
git remote add origin
git push -u origin master

But actually this code, beside creepy, is teaching us what we have to do on terminal (if we already don’t know).

First of all let’s initiate the git into the project folder on Terminal with “git init”. Yeah. Just like it.

And then just add the changed documents with “git add .” ( yeah, with this point after add, and a space before the point! it tells the computer you want to add all the content in this folder).

And then do our first commit, please write a nice message 😉
“git commit -m “the basis of our project” ” (like that, with the message under double quotation marks).

One of the main things is the telling your mac where it’s going to send your project, so that’s why you add a origin with “git remote add origin” with the secured url(https://) where the .git is -> git tells you in this creepy code part:

git remote add origin

and then you just hit push. Oh! yeah, in a git way: “git push -u origin master”

if you have a brunch on git, you can push to your brunch name: “git push -u origin brunchName”.

The terminal it’s going to ask your username to github and your password (it’s ok, the password, for security reasons doesn’t show when the user is typing). And voilá! It’s done, just reload your Github repository to see your beautiful project in there.


One thought on “Get yourself a Git!!

Leave a Reply

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

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


Connecting to %s