16

Edit: Summary: Every command entered in Git produces a hanging cursor which then says "bad input" if anything is typed before enter is pressed. No commands produce any results. I tried a fresh install with no results.

I am completely new to Git. No idea what I'm doing whatsoever. (I'm on a Mac)

I was following the basic instructions on the site:

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

But as soon as I type in "git init", the terminal hangs. I press enter, nothing happens, the prompt doesn't start a new line...it just starts a blank line with no blinking cursor. I press enter a second time, the prompt returns, having skipped a line in the terminal, and now waiting for my next command.

I don't really understand what's going on here, and I'm not sure if something's wrong or not.

EDIT:

Git was installed from the main downloads page.

http://git-scm.com/downloads

After I hit enter on git init I get the blinking cursor on a blank new line, and after a moment I hesitantly typed in Testing and hit enter again. It then spat out, on the next line, bad input: Testing and showed me a new prompt.

I tried reinstalling, but to no avail. I try other git commands, like git config --global user.name "Meeeee" But it doesn't matter. They all produce the same hanging.

temporary_user_name
  • 35,956
  • 47
  • 141
  • 220
  • That sounds horribly wrong. You should check your git installation. – pmr Oct 02 '12 at 23:48
  • Ideally, you should see a line like `Initialized empty Git repository in /Users/vlazarenko/a/.git/`. Do you see a `.git` directory if you type `ls -a`? – favoretti Oct 02 '12 at 23:49
  • Have you tried running git init in another directory? – Jordan Denison Oct 02 '12 at 23:51
  • Not sure what other source control you're familiar with, but this should basically be the same as `hg init` or `svnadmin create`. Something is very wrong if it hangs. Just one other thought, have you checked your disk space. – CrazyCasta Oct 02 '12 at 23:52
  • @favoretti No luck. Nothing there. Perhaps my Git installation is....flawed. – temporary_user_name Oct 02 '12 at 23:54
  • Try it with a different terminal. I suppose it *could* be caused with some really bizarre/incorrect termios .. –  Oct 02 '12 at 23:56
  • @pst Regarding title change, I was unspecific deliberately because all subsequent commands hang as well. And I'm just using the standard Mac terminal. What other terminal is there? (I am not a very experienced developer.) – temporary_user_name Oct 02 '12 at 23:56
  • Start a terminal as root user. Perhaps its not working and you have not enough rights to execute all commands. – René Höhle Oct 02 '12 at 23:57
  • How did you install git? Just curious, cause maybe the problem is somewhere there :) – favoretti Oct 02 '12 at 23:58
  • @Aerovistae `xterm` is also available in OS X. –  Oct 02 '12 at 23:58
  • Ok, that makes no sense since as far as I know git init doesn't take input. – CrazyCasta Oct 03 '12 at 00:10
  • Yeah...I don't think it has anything to do with Git. I mean, I get the same result from every git command...a hanging cursor that then says bad input if I type anything before pressing enter. This is something else...but I haven't the slightest idea what. – temporary_user_name Oct 03 '12 at 00:13
  • What does `file $(which git)` say? – Michael Burr Oct 03 '12 at 00:24
  • For that matter, just try `which git` and make sure it's the file you just installed (in addition to the `file $(which git)` suggestion). – CrazyCasta Oct 03 '12 at 00:33
  • 2
    Looking through the git source code, there are exactly two occurrences of `"bad input:"`, both in functions called `read_credential`. It's printed in an error message only if the line read from stdin does *not* contain an `=` character. But that should only happen if you run `git credential-wincred` or `git credential-osxkeychain`. What OS are you on? ... Never mind, I see you're on MacOS -- so *something* is probably invoking `git credential-osxkeychain`. Maybe somebody else can run with this and figure out the problem. – Keith Thompson Oct 03 '12 at 01:34
  • @KeithThompson really clever detective work, I would not have thought of that. – temporary_user_name Oct 03 '12 at 02:31
  • 1
    @Aerovistae: But there are no references to `credential-osxkeychain` outside `git-credential-osxkeychain.c` and the `Makefile`, so nothing should be invoking it implicitly. Can you confirm the *exact* error message (copy-and-paste)? – Keith Thompson Oct 03 '12 at 03:14
  • *Testing* being what I type in when it hangs on any git command, before pressing enter. – temporary_user_name Oct 03 '12 at 04:12

2 Answers2

9

Considering you are on OS X, and after Keith Thompson's comment, it is possible

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.

  • or you have several git installed:

It looks like you installed the git-credential-osxkeychain wrapper in the wrong place (did you cp 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 my PATH.

Community
  • 1
  • 1
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
  • 1
    So weird coming back and looking at this four years later, now that I'm a proficient git user. Git is bad enough when you're brand new to the command line and the idea of version control; this bug is really awful as a first experience. Makes you feel *really* lost, like you haven't even opened the program and you've already broken something. – temporary_user_name Jun 21 '16 at 00:06
2

Hmm perhaps you are in a directory which is not writable?

Normally you can create a directory.

mkdir test
cd test
git init

then you init an empty GIT repo in the test folder and you should see a folder named ".git" which is hidden. Perhaps you can try to build a bare repository.

git --bare init

But your problem sounds a bit strange. Du you run your command with all rights?

René Höhle
  • 26,716
  • 22
  • 73
  • 82