Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why is git hanging - have to press enter twice after commands?

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 [email protected]: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.

like image 967
temporary_user_name Avatar asked Oct 02 '12 23:10

temporary_user_name


People also ask

Why does git status hang?

If you are using Windows, check to see if some Windows process has some file or files in that repository locked. If so, your git command will wait for that other process to release the lock, before proceeding. If that other process never lets go, Git never proceeds.

Why is git add taking so long?

Git slowness is generally from large binary files. This isn't because they're binary, just because binary files tend to be large and more complex to compress & diff. Based on your edit indicating the file sizes, I suspect this is your problem.

Why my git push is not working?

If git push origin master not working , all you need to do is edit that file with your favourite editor and change the URL = setting to your new location. Assuming the new repository is correctly set up and you have your URL right, you'll easily be able to push and pull to and from your new remote location.

What is git add * command?

The git add command adds a change in the working directory to the staging area. It tells Git that you want to include updates to a particular file in the next commit. However, git add doesn't really affect the repository in any significant way—changes are not actually recorded until you run git commit .


2 Answers

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

  • you have an alias in place for git, invoking credential-osxkeychain.
    See "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.

  • 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.

like image 92
VonC Avatar answered Oct 11 '22 19:10

VonC


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?

like image 42
René Höhle Avatar answered Oct 11 '22 19:10

René Höhle