There are multiple reasons of getting this error, please check below one by one if it solves this issue –
Your git URL might have changed.
Change the URL in the local directory by using the following command
for https protocol
1 2 |
git remote set-url origin https://github.com/username/repository.git |
for ssh protocol
1 |
git remote set-url origin git@github.com:username/repository.git |
Your ssh key might have not been added with ssh-agent.
You have to apply following steps using your terminal:-
$ eval "$(ssh-agent -s)"
Agent pid 5867$ ssh-add <private-ssh-key-file-name>
// eg. id_rsa (not.pub
)Enter passphrase for /home/you/.ssh/id_rsa: [] Identity added: /home/you/.ssh/id_rsa (/home/you/.ssh/id_rsa)