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

returns

  • Git & CI: How to tag if build passes/revert commit if fails?
  • Refresh code without overwriting my changes
  • Docker deployment workflow with git
  • Git repository created without a master branch
  • How does Git(Hub) handle possible collisions from short SHAs?
  • Anyway to use an external diff editor in Eclipse with EGit?
  • 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.

  • Install node module from own gitlab server
  • Version control for subtitle creation
  • Git SVN case sensitive folder names
  • Git push style deployment for local IIS webserver
  • GIT merge and rebase workflow confirmation?
  • Update file with Git on Windows
  • 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

    Another advise:

    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

    Git Baby is a git and github fan, let's start git clone.