Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I'm following the instructions on importing an existing .git repository to GitHub.

When trying to add the .git repository to GitHub, I get the following error:

fatal: Not a git repository (or any of the parent directories): .git

I Googled it and that seems to mean the repository doesn't exist. However, Git GUI quite happily opens the same .git repository.

I've copy-pasted both the address to cd to and the command line to get my (existent) .git repository onto GitHub - No dice. I tested the ssh connection to GitHub; works perfectly ("You've successfully authenticated, but..." etc.).

Any ideas on what might be wrong or how to fix it?

share|improve this question
    
So apparently you can't use the command prompt to update to GitHub (and possibly doesn't work well with Git at all); you have to use Git Bash. That explains that. –  Narf the Mouse May 14 '11 at 7:31
    
If this answered your question, you can put it as an answer below - you can also accept it in two days. –  slhck May 14 '11 at 8:13

2 Answers 2

up vote 2 down vote accepted

You can use the command prompt for GitHub operation (needing ssh authentication).
But you need to define the %HOME% environment variable, which:

  • isn't defined on certain OS (like Windows)
  • is defined in the Git bash session (type echo $HOME)

%HOME%/.ssh is where Git is looking for the public/private ssh key needed by GitHub to know who you are.

share|improve this answer
    
Thanks, that explains it - I'm using XP. –  Narf the Mouse May 15 '11 at 21:42
    
@Narf: then define %HOME% in your "user environment variable", relaunch a shell session, and everything should work just fine. –  VonC May 15 '11 at 21:45
    
No worries; Git Bash worked fine. Guess it doesn't need a %HOME% variable. –  Narf the Mouse May 16 '11 at 4:06
    
@Narf: Git bash defines its own $HOME variable, so you are good there. –  VonC May 16 '11 at 5:39

in windows, you can go to Windows Explorer, right click the folder of your git repository, select "Git Bash here" from the context menu, then you can run your commands in the console window. It took me almost two days to figure this one out...

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.