If you have pushed something to a remote repository that should not have been pushed then do the following:
checkout locally the commit that you want to replace the erroneous commit (this should be a commit at an earlier stage than the unwanted one)
git push -f origin master
this will force the remote repository to be at this stage