Can't push to my git repository
I’m a n00b and i’m learning rails.
I’m having problems pushing my local repository to my github.
I’m doing the ruby on rails tutorial and i’ve got my github account set up. i’m on step 1.3.4 and typing:
C:\Sites\rails_projects\first_app> git remote add origin https://github.com/<username>/first_app.git
fatal: remote origin already exitst
i figured this is a good thing because it can see the repo. but when i push i get:
C:\Sites\rails_projects\first_app> git push -u origin master Permission denied (publickey) fatal: Could not read from remote repository. Please make sure you have the correct access rights and the repository exists.
I know the repository exists because it in my git account but when i use github for windows i get an error also. i think it may be a problem with my ssh keys. i’m trying to learn rails and any help would be greatly appreciated.
2 Solutions collect form web for “Can't push to my git repository”
You can choose between 2 protocols when connecting to GitHub: SSH or HTTPS. It’s hard to say which one is better (it is a separate question), but HTTPS is a little bit easier to setup because you don’t need to bother with SSH-keys.
Currently, according to the error, you have configured SSH protocol, but if you don’t want to generate keys, you can easily change it to HTTPS. In order to do this run:
git remote set-url origin https://<username>@github.com/<username>/first_app.git
Pay attention that I added
<username>@ in the beginning. This means that you wouldn’t need to enter your username each time you push. You can also configure git to remember your password for certain period of time. Look at GitHub docs how to do this: https://help.github.com/articles/set-up-git#password-caching
You probably didn’t add your public key to Github. Follow this guide to do it: https://help.github.com/articles/generating-ssh-keys
Don’t try to develop Rails applications with Windows!
You better use Virtual Image, for example: VirtualBox image
Or use Cloud Development Environment like: Nitrous.io