Search code examples
gitgithubgit-remote

New git repository error on first push


I did git init, then I realized I should include the link that I got when I made the repository in GitHub so I did this:

git init https://github.com/genadinik/AndroidMakeMoneyFree.git

Then I did:

git add -all
git commit -m "Adding repository contents"

And that worked fine, but then I tried to push and got this error:

git push origin master
fatal: 'origin' does not appear to be a git repository
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

Solution

  • I don't think git init accepts a URL (although I could be wrong).

    To add a remote repository run the following

    git remote add origin https://github.com/genadinik/AndroidMakeMoneyFree.git
    

    and for the first push you should use the following command to ensure all tags and such are pushed up.

    git push -u origin --all