Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot push to GitHub #77

Closed
Jaylenlee opened this issue Aug 26, 2020 · 3 comments
Closed

Cannot push to GitHub #77

Jaylenlee opened this issue Aug 26, 2020 · 3 comments

Comments

@Jaylenlee
Copy link

Versions:
IntelliJ : 2019.3.1
SourceTreeSetUp-3.3.9
JDK: 11

Context (What I did step by step):

  1. Did not create branch for JavaDoc, CodingStandard and Level 9. Did all on master branch. Pushed to GitHub.
  2. Decided to revert master branch on local repo to the commit before all those changes. (Point A-Jar).
  3. Created the 3 branches but named some branch wrongly (A-JavaDoc, A-CodingStandard)
  4. Did the coding on the branches and push to GitHub. (Before merging to master branch)
  5. Merged the branches to master branch, retag the commit.
  6. Realised branch is name wrongly and went to rename.
  7. Revert master branch to the commit before all changes again (Point A-Jar).
  8. Merge branch to master again, retag.
  9. Try to push but failed.
  10. Went to GitHub to delete the wrongly named branch and pushed local repo again but failed.

tl;dr: My branch-A-JavaDoc and branch-A-CodingStandard is not appearing as local repo option to push. When I try to push there is some error which I do not know how to resolve.

Thank you for the assistance in advance. I can clarify again if there is anything not clear.

Screenshot below:
![Error1](https://user-images.githubusercontent.com/54731199/91254557-46ab5b80-e795-11ea-807e-e14120c90d6c.JPG
Error2
Error3

@damithc
Copy link
Contributor

damithc commented Aug 26, 2020

If you change a commit that had been pushed to the fork already, you need to do a force-push. The remote repo will reject a normal push that changes commits that are already in the repo. Might have to use the command line to do a force push (last time I checked, can't do a force push using SourceTree).
e.g., git push -f origin master where -f tells git to do a force push

@Jaylenlee
Copy link
Author

Jaylenlee commented Aug 26, 2020

Thank you so much Prof! I managed to push it to GitHub with that! However 2 of my branches (branch-A-CodingStandard and branch-A-JavaDoc) is still missing from the push option. May I know why is this so and how to resolve?

*Edit: I manage to push my branch to GitHub using CLI but it's still not showing on SourceTree.
error4

@marcustw
Copy link

I'm not sure if this is the right way but I fixed it by making sure that my code on github is the most updated version, then I used IntelliJ to "get from git version control" again. Then open up SouceTree and locate the new local repo I cloned. Go to remotes -> branches -> check out on all the branches and they will show up in the "branches" tab of your local repo, and I think it will show up when you click on push.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants