3

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?

2
  • 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. May 14, 2011 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, 2011 at 8:13

2 Answers 2

2

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.

3
  • @Narf: then define %HOME% in your "user environment variable", relaunch a shell session, and everything should work just fine.
    – VonC
    May 15, 2011 at 21:45
  • No worries; Git Bash worked fine. Guess it doesn't need a %HOME% variable. May 16, 2011 at 4:06
  • @Narf: Git bash defines its own $HOME variable, so you are good there.
    – VonC
    May 16, 2011 at 5:39
1

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

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .