编辑:摘要:在 Git 中输入的每个命令都会产生一个悬挂的光标,如果在按下回车键之前输入任何内容,该光标就会显示“输入错误”。没有命令产生任何结果。我尝试了全新安装但没有结果。
我完全是 Git 的新手。不知道我在做什么。 (我在 Mac 上)
我遵循了网站上的基本说明:
touch README.md
git init
git add README.md
git commit -m "first commit"
git remote add origin git@github.com:aerovistae/MetPetDB-Mobile.git
git push -u origin master
但是只要我输入“git init”,终端就会挂起。我按回车键,没有任何反应,提示没有开始一个新行......它只是开始一个没有闪烁光标的空白行。我第二次按回车键,提示符返回,在终端中跳过了一行,现在正在等待我的下一个命令。
我真的不明白这里发生了什么,我不确定是否有问题。
编辑:
Git 是从主下载页面安装的。
在 git init
上按回车键后,我在一个空白的新行上看到闪烁的光标,过了一会儿,我犹豫地输入了 Testing
并再次按回车键。然后它在下一行吐出 bad input: Testing
并向我显示一个新提示。
我试过重新安装,但没有用。我尝试了其他 git 命令,例如 git config --global user.name "Meeeee"
但没关系。它们都产生相同的悬挂。
最佳答案
考虑到您使用的是 OS X,并且在 Keith Thompson 之后的 comment ,这是可能的
- 你有一个 git 的别名,调用
credential-osxkeychain
。
参见“Git hangs indefinitely - broke with osx credential helper I think”:
you've aliased git to something else (probably
alias git="git credential-osxkeychain"
), and you should look in~.profile
to see if you can remove the alias.
- 或者你安装了多个 git:
It looks like you installed the
git-credential-osxkeychain
wrapper in the wrong place (did youcp
to/usr/bin/git
instead of/usr/local/git/bin
?)
To fix, you'll want to just delete/usr/bin/git
; assuming git is still installed in/usr/local/bin
it should take over.It's actually installed to
/usr/local/git/bin
so I just added that to myPATH
.
关于git - 为什么 git 挂起 - 必须在命令后按 enter 两次?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12700047/