-1

I have a repository on GitHub at https://github.com/andrewthommo/ComA

I have newly created source on my local file system that I would like to enter into that repository. After looking at this answer I tried using Git from the command line with:

git remote -m MyEmail@gmail.com:andrewthommo/ComA.git
error: unknown switch `m'

..and also..

git remote add -m MyEmail@gmail.com:andrewthommo/ComA.git
usage: git remote add [<options>] <name> <url>

Obviously, I am very confused. Can anybody see where I am going wrong?

(I am currently looking through Git for beginners: The definitive practical guide for tips..)

Community
  • 1
  • 1
Andrew Thompson
  • 168,117
  • 40
  • 217
  • 433

1 Answers1

2

You have put your own e-mail address as the repo address, that's not correct. For github, it's git@github.com:username/repo.git

Also, there's no -m switch for remote command, see man pages. The -m switch actually does exist, but only for add operation, see the man pages for an explanation on it's usage - it is not needed in this case.

You need to specify a name for the remote. Typically it's called origin.

Assuming you have issued git init on your local folder, correct command is:

git remote add origin git@github.com:andrewthommo/ComA.git
1615903
  • 32,635
  • 12
  • 70
  • 99
  • That last command returns with no error but does nothing. I am tempted to mark this answer correct & pursue the 'does nothing' in a different question. I think your latest edit might cover it (I was suspecting 'wrong directory').. – Andrew Thompson May 15 '13 at 06:54
  • What do you get if you now type `git remote` without parameters? It should list all configured remotes. If origin is listed there, you have succeeded, and `git push` would get you going with everything else. – 1615903 May 15 '13 at 06:56
  • I was in the parent directory to where I needed to be (just for clearing up old matters). `git remote` now shows 'new' & next line 'origin'. The reason I am thinking it failed is twofold. 1) I have a slow connection and the command returns almost immediately. 2) I don't see any change in the listing of the repository at the URL in my question. – Andrew Thompson May 15 '13 at 07:01
  • I am marking your answer correct since you have answered my original question and given me a lot to think about. I'll mull it over and form a new question if needed. Thanks! – Andrew Thompson May 15 '13 at 07:03
  • Adding a remote does not create any network activity - `git push` and `git pull/fetch` are the commands that interact with the remotes that you have configured. Seems you now have two remotes configured, one called _new_ and one called _origin_ - i suggest you remote the _new_: `git remote rm new`. Glad I could help. – 1615903 May 15 '13 at 07:05
  • Oh right! I get now, how I misunderstood what you were saying in an earlier comment (it is entirely clear reading it again, the fault is mine, not the words used). Call me a 'happy dill'. :) – Andrew Thompson May 15 '13 at 07:09
  • 1
    @laertis true - I have amended my answer. – 1615903 Apr 19 '17 at 04:56