Put my project in Github Repo


When I created my first project,I created a repo (say project1) on my github account and then cloned it in my machine. And then pushed to it whenever code in my machine was updated.

Now I created another project- say project2 in my machine. Tested it, created local repo using git init. I want to push this project to github. For this purpose I created a repo on github named project2. It now has a .gitignore and readme.md files in it.

Now, how do I add my existing code to this? When I cd'd to my project2 directory and tried git push, I get this error:

fatal: No destination configured to push to.

I tried git push project2

fatal: 'project2' does not appear to be a git repository
fatal: The remote end hung up unexpectedly

Please help me correct this error

You need to add the new repository as a remote:

git remote add project2 [email protected]:Nickname/project2.git