Can't push back to Github
I’m new to github, and keep running into basic errors. Most tutorials seem to be missing something here or there, or more probably it’s me who’s missing something… 🙂
"git init" "git clone ... " (github url) "git add ." (adds the entire directory.
I don’t understand why I would need
add something that I just cloned…
Isn’t it obvious that these are the files I want to work with?)
"git commit -m" this works. "git push" Now here the whole thing comes crashing down.
I would expect that when you clone something from github, the “
push” command would push your changes right back.
But that does not seem to be the case. Git has no idea where my files came from? If I type
"git push origin master” I get the error:
fatal: No configured push destination.
How do I create the push destination in such a way that it is exactly the same as where my files were cloned from?
3 Solutions collect form web for “Can't push back to Github”
It looks like you’re initializing a new repo and then doing some cloning, which can be confusing…
1. moving to fresh folder so your previous work doesn’t create confusion
clone from the github repo you want to work from
cd into that repo and
git status to make sure everything is in order
You should only need to
push after you’ve made changes. So try the rest of that workflow after you’re sure you’re in the repo you intended to clone. (instead of a new one you just created)
Check out Learn Git Branching, it’s a great tutorial that helped me and a bunch of my colleagues.
git clone ...
commit & push generally works better after any modification.
You can also use git diff to find the difference between working directory & last commit.
GitHub also provide tools for ease (in case u often get confused with cmd)