I’m stuck with my first GitHub push and need help
I’m trying to push my code to GitHub for the first time but keep running into issues. When I run the push command, I get these errors:
user@laptop:/var/www/html/myApp$ git push origin main
error: failed to create directory for .git/refs/remotes/origin/main
error: Unable to lock the ref 'refs/remotes/origin/main'
Everything up-to-date
I followed the setup guide from GitHub but something isn’t working right. Has anyone seen this kind of error before?
When I try running it with sudo, I get a different error:
Permission denied (publickey)
fatal: Could not read from remote repository
I also tested my SSH connection with ssh -vT [email protected] and it shows I can authenticate successfully:
OpenSSH_5.9p1, OpenSSL 1.0.0a 29 Mar 2010
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: Connecting to github.com [192.30.255.112] port 22
debug1: Connection established
debug1: identity file /home/user/.ssh/id_rsa type 1
debug1: Remote protocol version 2.0, remote software version babeld-2e9d163d
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: server->client aes128-ctr hmac-sha1 none
debug1: kex: client->server aes128-ctr hmac-sha1 none
debug1: Authentication succeeded (publickey)
Hi username! You've successfully authenticated, but GitHub doesn't provide shell access
Connection to github.com closed
The SSH test works fine, so I’m confused why the push command fails. Any ideas what might be causing this?