Starting creating a new repository - UnbDroid/AprendendoGithub GitHub Wiki

Frist of all, once we have git installed, it does not works by itself. That is, every directory that we works on our computer is not controlled by the git and if we want use git on some directory, we have to say it to git.

Once you have already said to git to tracking the directory, all the files, folders and subfolders recursively inside it. Inside the main folder there is a invisible folder called .git that controls your files and does not matter this folder, it is just to configurations and we are not going to change it. It is only important knowing this folder controls the directory.

If you wanna see if some repository is tracked by git, there are two ways to see it:

  • You can open the terminal and type the command git status. If you see the message Not a git repository, the git is not tracking the directory.
  • You can see the .git folder on the main folder pressing Ctrl+H in your software manager, or typing ls -a on terminal.

What do we do to say to git? We have a single command:

git init

Frist, go to a working folder, where your files and git repositories are going to stay. In our case, we are going to create a folder called GitHub in our home. To do that, type de commands:

mkdir ~/GitHub
cd ~/GitHub/

Now, our project name(or repository name if you prefer) is FristRepository. To do that, type the commands:

mkdir FristRepository
cd FristRepository
git init

So, our frist repository is created. All the files(at this moment there is no files inside it) inside the folder ~/GitHub/FristRepository/ are tracked by the git. To see if the git is really working, type git status, if everything is working well, you will receive the message:

On branch master

Initial commit

nothing to commit (create/copy files and use "git add" to track)