Github push error. Permission denied

2020-03-17 04:18发布

I am just trying to create my first repo from Ubuntu 11.10 with this command:

I was about to finish sudo git push -u origin master

Permission denied (publickey). fatal: The remote end hung up unexpectedly

How can this be fixed?

I tried this too. i.e git push -u origin master. I got this error.

error: could not lock config file .git/config: Permission denied error: could not lock config file .git/config: Permission denied Branch master set up to track remote branch master from origin. error: unable to create directory for .git/refs/remotes/origin/master error: Cannot lock the ref 'refs/remotes/origin/master'. Everything up-to-date

标签: git github
4条回答
家丑人穷心不美
2楼-- · 2020-03-17 04:40

If you're just creating a repo, there's no need to do a git push; git init will create the repo. Also, I would stay away from using sudo when running git. You might also want to go to this site to help you understand git: http://progit.org/book/ch1-3.html

If you are using github, you might want to read this: http://help.github.com/linux-set-up-git/

查看更多
SAY GOODBYE
3楼-- · 2020-03-17 04:45

Could this be of any help?

Quote:

Did you forget to add your public key to the github project settings? Also check to make sure your private key is in your .ssh directory.

Goto https://github.com/[username here]/[project name here]/edit and make sure your public key is set.

Read this too: http://help.github.com/mac-key-setup/

查看更多
狗以群分
4楼-- · 2020-03-17 04:57

Hello it could be because you're trying to git push as root, with sudo, did you set your public key or root key, usually you just supply your key and not the root key, that could be why you're getting such error.

查看更多
聊天终结者
5楼-- · 2020-03-17 05:00

If you think it's because of false lock, try removing the lock file:

Mac or *nix

rm -v .git/config.lock

Windows

del .git/config.lock
查看更多
登录 后发表回答