Skeeve
Skeeve

Reputation: 1255

git push -u origin master mistake

Ok, I guess this question is popular, but I just dint understand. I create a new repo on GitHub, then I go to my folder, where I have some code I do the next steps:

git init
git add .
git commit -m "Initial commit"
git remote add origin https://github.com/MyNick/MyCode.git
git push -u origin master

And so I get:

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.

What am I doing wrong? Thank you.

Upvotes: 1

Views: 285

Answers (3)

ssedano
ssedano

Reputation: 8432

Try adding the ssh repo.

It is very likely that is something like

git remote add origin [email protected]:MyNick/MyCode.git
git push -u origin master

That should work well.

Upvotes: 2

Chris Throup
Chris Throup

Reputation: 671

Are you sure you have created the GitHub repository? The error message suggests it can't find a repo at the GitHub URL. You may have just faked it as an example, but I get a 404 error when I try to access https://github.com/MyNick/MyCode.git.

Upvotes: 0

dusual
dusual

Reputation: 2207

Well the above answers should work . Another suggestion when in doubt check you .git/config file . It will give you most of the details related submodules/origin/branches you may need to know

[remote "origin"]
        fetch = +refs/heads/*:refs/remotes/origin/*
        url = xxx

[branch "master"]
        remote = origin
        merge = refs/heads/master

[submodule "submodule"]
        url = xxx

Upvotes: 1

Related Questions