3

What I have done:

git init 
git remote add master www.xyz.org/git/arkad

fatal: 'origin' does not appear to be a git repository
fatal: The remote end hung up unexpectedly

I have http access to the remote git.

How to fix this?

Thanks.

AjayKumarBasuthkar
  • 2,885
  • 2
  • 23
  • 27

2 Answers2

9

You added a remote called "master", not "origin". In your case you would need to do:

git push master master

You probably want to read the man page for git remote, and you might now want to rename your remote to origin:

git remote rename master origin

Additionally it appears you didn't specify a protocol to use to talk to the remote: it will probably be either ssh:// or git://. Given the fact there are two problems with your remote config you might want to do the following to correct your configuration:

git remote rm master
git remote add origin ssh://www.xyz.org/git/arkad

Note: this assumes that you need to talk to the server over the ssh protocol, as noted above it could also be that you need to use the git protocol instead.

More useful help can also be found here courtesy of the awesome guys at github.com.

jkp
  • 78,960
  • 28
  • 103
  • 104
  • getting fatal: 'www.xyz.org/git/arkad' does not appear to be a git repository fatal: The remote end hung up unexpectedly –  Jun 05 '12 at 13:57
  • 1
    @arnold, are you sure `www.xyz.org` does really accept SSH connections? Or are you missing `http[s]://` may be? – kostix Jun 05 '12 at 13:58
  • 1
    @arnold: You didn't specify the protocol when adding the remote. The command to add a remote really just adds a line in a config file (.git/config): it doesn't verify that you gave it a valid endpoint. – jkp Jun 05 '12 at 13:59
  • after specifying the protocol its ask for user name and pass then getting error error: src refspec master does not match any. –  Jun 05 '12 at 14:06
  • @kostix I am getting "getting error error: src refspec master does not match any." after specifying the protocol –  Jun 05 '12 at 14:19
  • @arnold this means you do not have a local branch named "master" (that "src refspec" means "source reference specification"; a branch is one kind of such reference). This might be either because you aren't on the branch "master" but rather on some other branch (check by running `git branch`) or you did not commit anything yet, so the branch does not really exist yet (as it contains no commits that the "master" reference would, well, *reference)* -- see [this](http://stackoverflow.com/q/5802426/720999) for more info. – kostix Jun 05 '12 at 17:12
1

You have to push to correct remote server. Just look at here:

git remote -v 

For example my own personal repo gives me:

% git remote -v
origin  git@github.com:farslan/farslan.github.com.git (fetch)
origin  git@github.com:farslan/farslan.github.com.git (push)

Therefore I can use:

git remote origin master
Fatih Arslan
  • 16,499
  • 9
  • 54
  • 55