Why I can't push my code in remote repo?

I can’t push my code in my repo It show me this error.

The remote branch is ahead of your local one, it has work on it that isn’t in your local branch so you need to pull that work in first before you can push

2 Likes

You can do 2 things here
You certainly have added and committed the changes, so all you have to do is run
git pull, this would fetch the changes from github to your local repo, and then you can use git push to push your local changes to github.

There may be an issue of merge conflict here, but that needs to be resolved if you want to keep your local changes.

You can also reset your current branch to the last commit, run git pull and then start with the changes again (If the changes you made were not much).

2 Likes