Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

So I have a local repo and a server with git installed and a git user.

I want to send (push) the repo to the server. When I simply login to the server via ssh I have to specify my .pem file and a passphrase.

The following:

sudo git push git@333.3.3.3..3:somerepo.git

throws this error:

 Permission denied (publickey).
 fatal: The remote end hung up unexpectedly

Another attempt another error:

git push ssh://git@222.2.2.2:somerepo.git
ssh: Could not resolve hostname : Name or service not known
fatal: The remote end hung up unexpectedly
share|improve this question
    
Why are you using sudo? –  demure May 23 '13 at 22:32
    
Do you get same error when git clone? –  Raza May 23 '13 at 22:34
    
sudo: just trying things. added as a remote. Didn't help. Same erro with git clone. –  gyaani_guy May 23 '13 at 22:41

2 Answers 2

Too many questions open for a precise answer.

sudo git push git@333.3.3.3..3:somerepo.git

Are you sure this is a valid IP address?
(sudo is definitely wrong here.)

Permission denied (publickey).

Your server seems to allow ssh connection only via publickey. Did you create a key pair? did you put the public key on the server? Does ssh-add add the key to your agent?

git push ssh://git@222.2.2.2:somerepo.git ssh: Could not resolve hostname : Name or service not known

Is this another host? Does it contain a repo, too? Seems like it just does not exist.

How did you create the repository on the server? Are you able to ssh into the server?

share|improve this answer

First, make sure ssh works to the server. Then, go on the server and create a bare repo "mkdir repo", "cd repo", "git init --bare". Then, from your machine you can do a "git push ssh:user@server:repo".

share|improve this answer
    
I'm making the assumption you don't have a repo on the server yet versus having one and trying to push. –  pcm May 26 '13 at 22:27

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.