I just created a new git repo on Gitlab.
I init and pushed an already populated directory in the following manner:
git init
git remote add origin [email protected]:username/reponame.git
git add .
git commit -m 'first commit'
git push -u origin master
All worked as expected. However, when I try to pull back from the repo i get
Permission denied (publickey).
fatal: The remote end hung up unexpectedly
This error appears for:
git pull
git fetch
It does not appear for:
git push
Push is working fine, I have made several pushed several changes...
I did initially get my ssh password wrong a few times and attempted at first to push an empty repo.
What is wrong here?
Ok so it appears.
Git init generated a FETCH_HEAD file that belonged to root. The rest of .git/ was my users.
I had to change the ownership of the file to my user an then the problem resolved.
Why it was not simply refusing me permission to access the file I do not know.