Context: I forked a repo and cloned the fork to localhost. Then instructions were to run git remote remove origin
in the terminal. I edited some of the code and am now done for the day.
Expectation: I would like to add this updated code to MY forked repo but not to the origin. I was taught to add to repos with these commands:
git add <name>
git commit -m "Message"
git push origin main
Problem: At this time there is no remote and when I do create a remote with the URL from my forked repo and try to push, it needs an upstream.
I was taught to add the origin as the upstream, so in this case it would be the repo that I forked, but that's not what I want to do.
CodePudding user response:
Assuming you only cloned your already forked repo, then all you really needed to do was clone that and use it like normal.
It sounds like you removed that remote in your local copy so you would need to add it back if you want to be able to update.
Verify that you have a remote set up
$ git remote
origin
If you don't have a remote set up, then you'll have to add it back. Add a remote called origin
:
$ git remote add origin [url to your repository]
Once that is set, you should be able to push your changes as usual.