My shell prompt looks like this: ➜ ~ git:(master) ✗. How can I get my normal prompt back?

前端 未结 10 1816
别跟我提以往
别跟我提以往 2021-01-03 07:56

My normal terminal command line has suddenly disappeared and has been replaced by this git command line ➜ ~ git:(master) ✗.

How do I get rid of this an

相关标签:
10条回答
  • 2021-01-03 08:16

    I know your problem , You are using zsh, right?

    If so, you should add export PS1=xxxxx to ~/.zshrc, not ~/.bashrc.

    Or you just don't use zsh , input bash and switch to bash.input chsh -s /bin/bash to change the default shell to bash.

    0 讨论(0)
  • 2021-01-03 08:18

    I also has this problem like: "➜ ~ git:(master) ✗" on the Mac OS X. Because I type the command "git init".

    When I type the command "rm -R .git", it comes back into normal command line in Terminal. PS: I use zsh.

    0 讨论(0)
  • 2021-01-03 08:21

    Open your ZSH config file

    sudo vim ~/.zshrc

    and paste below command at the bottom of the file

    PROMPT='${ret_status} %{$fg[cyan]%}%c%{$reset_color%} '

    this will show current directory

    0 讨论(0)
  • 2021-01-03 08:28

    You must have installed something (I'm not sure what) that modified your prompt to give you context-sensitive information about the Git repository (if any) you're in.

    Simply adding

    export PS1="\h:\W \u\$ "
    

    at the very bottom of your

    • ~/.bash_profile file, if you use bash, or
    • ~/.zshrc file, if you use zsh,

    and then sourcing that file (or restarting Terminal) should rid you of that fancy colourful prompt.

    0 讨论(0)
  • 2021-01-03 08:29

    There is nothing wrong with your system or you change something involuntarily. You must have download oh-my-zsh and set your default terminal from bash to zsh. Oh-my-zsh has many different themes, all these themes have different appearances and provide more efficient functions, git information is one of them. The default theme of oh-my-zsh is "robbyrussell" and it just looks like your shell prompt. You can go to "~/.oh-my-zsh/themes" to choose your favorite theme and apply it to the configuration file "./zshrc". I know you have solved the problem by uninstalled the zsh and use the original bash, I just want to tell you the essential reason of this problem. And oh-my-zsh truly provides some convenience which helps you use the command line, maybe you should try it again!

    0 讨论(0)
  • 2021-01-03 08:33

    if you having seen the (master) in somewhere your folder. try this

    git rm .git
    

    It will automatically remove the master

    0 讨论(0)
提交回复
热议问题