Reputation: 111
I tried to push to an aws ec2 instance using git but I always get this error :
error: pack-objects died of signal 13
error: failed to push some refs to ssh://ubuntu@..../..../myrepo.git
what i did:
1- create a git bare repository on my ec2 server (ubuntu 18.04)
mkdir myrepo.git
cd myrepo.git
git init --bare
2- in my local machine (ubuntu 16.04):
a- add myserverkey.pem in ~/.ssh/
b- add the following to .ssh/config
Host myserver
Hostname myserverpublicdns
User ubuntu
IdentityFile ~/.ssh/myserverkey.pem
c- in my project directory I did the following:
git init
git remote add origin myserver:/~/path/to/myrepo.git
git add .
git commit -m 'test commit'
git push origin master
also, I tried
git remote add origin ssh://ubuntu@myserverpublicdns/home/../path/to/myrepo.git
and it gives the same error when I push to the server
The error is :
Counting objects: 547, done.
Delta compression using up to 4 threads.
Compressing objects : 100% (530/530), done.
error: pack-objects died of signal 13
error: failed to push some refs to ssh://ubuntu@..../..../myrepo.git
and I couldn't find any solution for my case
Notice that my project size is only 4.5mb and I can connect to my server using :
ssh myserver
which means there are no mistakes in the .ssh/config file
So what is the problem ?? what I am doing wrong ??
Thanks in advance !!
Upvotes: 0
Views: 208
Reputation: 877
The resolution of myserver in the lines:
git remote add origin myserver:/~/path/to/myrepo.git
may not work because "myserver" must be resolved by your /etc/hosts file otherwise git won't find your server.
Your ssh command works because your ssh config file does make the link between myserver and the hostname of the instance.
(If you don't want to update your config every time you stop your instance, setup an elastic-ip on your instance)
You should also have a look to folder permission, you are connecting with ubuntu user, make sure it has the proper right on the git repository path.
Do NOT set a 777 right on a folder, never. Instead create a group :
groupadd mygitgroup
then add the user ubuntu in this group
usermod -aG mygitgroup ubuntu
set the proper right on the git reposity to the group :
chgrp -R mygitgroup /my/git/path
remove invalid right
chmod 770 /my/git/path
Upvotes: 1