1

I am having trouble setting up my git repository on a local machine. In particular, when I try to run "git push origin master" command, it asks me for a password for my ubuntu@ec2-##-###-###-###.compute-1.amazonaws.

Needless to say, I don't know of any password and do not remember setting it up. (I have tried using my aws user password but it didn't work). Here is what I've done so far:

On a remote server:

Created and initiated a --bare html.git directory.

On a local machine:

Ran commands,

git remote add origin ssh://ubuntu@ec2-xx-xxx-xxx-xxx:/var/www/html.git

and

git config --global remote.origin.receivepack "git receive-pack"

Afterwards, when I try to push to the origin from a git folder on local machine, I get prompted for a password.

I have tried using an RSA key. Generated it on my machine. Appended it to the authorized_keys file located in ~/.ssh folder on the remote server and then, before trying to push from local machine, added the key identity to the authentication agent ( on a local machine ). The result was the same. Can anyone please help me out? I realize that this question might look like a duplicate one but I just seem to have hit a wall here. I've searched for solutions before posting here and got some hits ( in fact, that's how I was able to figure out the whole process of installing and configuring this git server/client duo ) but was not able to find anything that would help me with this authentication problem.

Thanks in advance

  • This is most likely an issue with adding the key to your local authentication agent. How did you add your ssh key? Did you try any of the methods here: https://stackoverflow.com/questions/4565700/specify-private-ssh-key-to-use-when-executing-shell-command ? – moebius Sep 07 '18 at 00:40
  • I have looked at it just now, but not sure what I need to do. – Vladimir Stremoukhov Sep 07 '18 at 01:49
  • I notice that many examples use "git@blah-blah-blah", while I use "ubuntu@blah-blah-blah" I understand that these are two different user names. One is for Git server and the other is for ec2 instance. Which one should I use? – Vladimir Stremoukhov Sep 07 '18 at 02:17
  • Ok. I had a little progress. I am now able to clone my remote repository. But when I try to push something to origin I get this message: remote: error: insufficient permission for adding an object to repository database ./objects remote: fatal: failed to write object error: unpack failed: unpack-objects abnormal exit To ubuntu@ec2-34-231-147-240.compute-1.amazonaws.com:/var/www/html.git ! [remote rejected] master -> master (unpacker error) error: failed to push some refs to 'ubuntu@ec#-##-###-###-###.compute-1.amazonaws.com:/var/www/html.git' – Vladimir Stremoukhov Sep 07 '18 at 02:43
  • I have been following the instructions in this thread https://stackoverflow.com/questions/50197592/setting-a-remote-git-repository-on-aws-and-pushing-from-windows – Vladimir Stremoukhov Sep 07 '18 at 02:45
  • You need to make sure that the folder hosting the git repository (/var/www/html.git) is accessible to the `ubuntu` user on the remote server (i.e read/write permissions). – moebius Sep 07 '18 at 03:18
  • That's it! Thank you! I was careless with permissions when creating folders. I've created the repository in the VPS while in "su" mode, which made it accessible only to root. – Vladimir Stremoukhov Sep 07 '18 at 03:39

0 Answers0