Not a git repository (or any of the parent directories): .git how to solve?

2

Good morning, I'm learning to use git and I need to check out a branch.

I made the clone in git:

$ git clone https://[email protected]/teste/teste-site.git
Cloning into 'teste-site'...
remote: Counting objects: 10818, done.
remote: Compressing objects: 100% (7681/7681), done.
remote: Total 10818 (delta 2982), reused 10588 (delta 2849)
Receiving objects: 100% (10818/10818), 420.92 MiB | 3.22 MiB/s, done.
Resolving deltas: 100% (2982/2982), done.
Checking connectivity... done.
Checking out files: 100% (11415/11415), done.

And after that I did the command:

$ git checkout master teste-site.git
fatal: Not a git repository (or any of the parent directories): .git

But this error returns me

  

fatal: Not a git repository (or any of the parent directories): .git

How do I solve it?

    
asked by anonymous 19.10.2015 / 15:09

2 answers

3

When you give clone git creates a nine directory for the repository. You have to run checkout from within that directory.

Try to make a cd teste-site

If you do not want to specify the name of the directory to be created, add it to the end of the command:

$ git clone https://[email protected]/teste/teste-site.git meu-diretorio

If you are already in the directory where you want to make the repository clone, you can use the dot:

$ git clone https://[email protected]/teste/teste-site.git .
    
19.10.2015 / 15:34
1

To change a branch, simply use the command:

git checkout nome-da-branch

If the branch does not exist and you want to create:

git branch minha-branch
git checkout minha-branch

The command you used is invalid, because it points to a directory that does not use git.

    
19.10.2015 / 15:24