Git push fatal failed

gitpush

I somehow deleted the whole directory of my code branch. I cloned a new one. It worked fine except pushing.

~/workspace/wtf (mybranch)]$ git push origin  mybranch 
error: Cannot access URL [my url], return code 22
fatal: git-http-push failed 

git pull works, though. How can I fix it?

Best Answer

I made the mistake of using https instead of ssh for a fresh copy. I since then made modifications and commits but could not push for obvious reasons.

To recover, I simple changed the section [remote "origin"] in .git/config from

url = https://github.com/AIFDR/riab_core.git

to

url = git@github.com:AIFDR/riab_core.git

After that, I could push again.

Related Question