Doubt about Git - branch master

Asked

Viewed 50 times

1

Look at the image below, I’m no longer inside the directory where my Git repository is, but the master branch keeps popping up. Why? inserir a descrição da imagem aqui

  • I don’t know if it has anything to do with git itself, it could be a shell bug

  • Hmm, I tried to reinstall Git bash, but it didn’t work. You know how I can try to fix it? @Denisrudneidesouza

  • Give more details of which operating system you are using (Windows, Linux, etc.), and which shell you are using (bash, zsh, etc.). Also inform us as the variable PS1 is defined, since it is here that the string of the prompt is defined. Also check if, by mistake, a directory was not created .git at your user’s home...

  • @Eduardobaitello, you got it right, it was a directory . git created by mistake. Thank you.

  • If anyone can signal as answered, thank you. I am new here and still do not know the good practices etc, I will inform myself. Thank you.

  • Hi João. I added as a comment because I asked for additional information about the problem. Ideally, however, solutions should be posted as an answer (I wrote an answer now with what would make you find the solution in the same way). Take a look here to understand better How and why to accept an answer and on the "votes in favour".

  • Thank you @Eduardobaitello, Eduardo, where can I find Stack’s best practices? I want to fit the community.

  • I recommend you start with Tour to understand the main concepts (you will even get a medal for completing it). In Help Center you can find frequently asked questions, including good practice questions regarding questions, answers, behavior, etc. If you still have any questions about how to use the site, you can use https://en.meta.stackoverflow.com/ to search for your answer or even ask a new question.

Show 3 more comments

1 answer

2


The configuration responsible for the prompt string is done by variable PS1. Assuming Linux + bash, this variable must be set in .bashrc of your user.

If everything is all right with the configuration of PS1 the problem is usually a directory .git created in the wrong place. Check your user’s home if you have a .git that shouldn’t be there. Delete/move it if necessary.

  • Thanks @Eduardobaitello. It was an archive .git created improperly in my home directory.

Browser other questions tagged

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