Not a git Repository (or any of the Parent Directories): . git como resolver?

Asked

Viewed 2,449 times

2

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

I did 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 made the command:

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

But this error returns to me

fatal: Not a git Repository (or any of the Parent Directories): . git

How do I resolve?

2 answers

3


When you give clone git creates a nine directory for the repository. You have to run git 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 clone the repository, you can use the dot:

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

1

To switch branch simply use the command:

git checkout nome-da-branch

If the branch doesn’t 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.

  • The problem is that it did not enter from the directory in which the repository was cloned before checking out the branch. The hugomg’s answer is the correct one, I believe

  • "The command you used is invalid because it points to a directory that doesn’t use git." That’s what I put, and my intention was to show a little bit about these basic git commands, since we can see that it doesn’t have much familiarity.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.