简体   繁体   中英

Why git@github.com: Permission denied (publickey) in windows?

I have simply created a repository in github. Using the commands I am trying to upload a project to my new repository. But giving me errors after this command:

git remote add origin https://github.com/nafeeur10/rental.git

Error:

fatal: remote origin already exists.

Then

git push -u origin master

Error:

git@github.com: Permission denied (publickey). and the repository exists.

What is the problem and what should I do actually?

1.If origin url is already added, you can use "git remote -v " to see what origin is already added.

Since you have origin already set to some url, you can update origin url using

git remote set-url origin https://github.com/nafeeur10/rental.git

2.You might not have permission to push to master branch. Try pushing to new develop branch.

fatal: remote origin already exists.

This error message indicates remote is already configured with the same name. Either add the new remote with a different name or update the existing one.

To set new remote:

$ git remote set-url origin https://github.com/nafeeur10/rental.git

Or can update existing one:

git remote add origin1 git@github.com:ppreyer/first_app.git 

Doing so, everywhere in "origin" you should replace it with "origin1". For example $ git push origin master should now be $ git push origin1 master.

Your remote origin exists. So you are probably getting this error because you didn't initialize or reinitialize(in case of a new commit in previously existing repository) your git repository. First type command "git init". After that try this command.

git push -u origin master

Then you might be prompted for authentication. Provide your credentials and changes will be pushed to your remote repository.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM