0

I want to push a remote folder to Github (git@github.com:myProject/Myproject.git), I connect to my remote server vis ssh then I type in my git repo :

git add myFolder
git commit -m "add my folder"
git remote add origin git@github.com:myProject/Myproject.git
 >>fatal: remote origin already exists.
git push -u -f origin master
>>Password for 'https://anotheruser@bitbucket.org': 

I think I need to change maybe the remote folder from Bitbucket to github or what ?

user2997418
  • 648
  • 1
  • 8
  • 22
  • use `git remote add origin https://github.com/myProject/Myproject.git` instead of `git remote add origin git@github.com:myProject/Myproject.git` – wt.cc Mar 23 '17 at 09:41
  • @wt.cc that is not the problem here. The problem is that OP already has a remote called `origin` and therefore cannot add a new remote with the same name. – 1615903 Mar 23 '17 at 09:41
  • oh, sorry, you need `git remote rm origin` firstly – wt.cc Mar 23 '17 at 09:42
  • @1615903 But would there be any unintended consequences of changing the URL without actually removing and adding a completely new one? – Tim Biegeleisen Mar 23 '17 at 09:44
  • @wt.cc seems like it worked but after sudo git push -u -f origin master I get fatal: Could not read from remote repository. Please make sure you have the correct access rights and the repository exists. – user2997418 Mar 23 '17 at 09:45
  • Then your credentials are probably wrong, or Github doesn't recognize your public SSH certificate. – Tim Biegeleisen Mar 23 '17 at 09:46
  • @TimBiegeleisen no. The behaviour is exactly the same in both cases. And besides, the answers in the duplicate cover both cases. – 1615903 Mar 23 '17 at 09:46

0 Answers0