简体   繁体   中英

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.

Try adding the ssh repo.

It is very likely that is something like

git remote add origin git@github.com:MyNick/MyCode.git
git push -u origin master

That should work well.

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

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 .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM