2

I've checked stackoverflow a lot trying to figure out why I could be receiving this error because I do have a repo on github for what I am trying to push to. I even regenerated my ssh key and added it to github. I also see:

Please make sure you have the correct access rights

and the repository exists.

When I try to add the repo remotely I see:

$ git remote add origin git@github.com:<username>/<reponame>.git
> fatal: remote origin already exists.

$ git push

fatal: The current branch master has no upstream branch.
To push the current branch and set the remote as upstream, use

git push --set-upstream origin master

Then I get the error

When I try

ssh -T git@github.com

I see the correct username

Not sure what else to try.

stillearning
  • 393
  • 2
  • 15

2 Answers2

3

If you have already typed

$ git remote add origin git@github.com:<username>/<reponame>.git

you can not type it again, because origin is exist now. And it will respond

fatal: remote origin already exists.

but the address which link to origin may wrong. Try to type

$ git remote remove origin

and type

$ git remote add origin git@github.com:<username>/<reponame>.git

again.

Then type

$ git push origin master

If both the address and SSH key are correct, it may work.

DDK
  • 136
  • 1
  • 1
  • 11
0

try this

git push origin master

read this documentation for more options with git push

https://git-scm.com/docs/git-push

VAMSI AILA
  • 61
  • 1
  • 13