I'm new to Git, trying to get myself set up correctly. I have a remote repo and a local clone, with so far only the one (master) branch.
I deleted some files in local, committed this change, then did 'git push origin master', which appeared to work successfully. 'git status' now shows nothing to commit in local.
However, when I look in remote repo, the files are still there, and 'git status' shows them all as added but not committed. Should pushing my changes not have deleted them from remote? What am I doing wrong?
The problem is that you apparently push to a non-bare repository. A push will never update a remote working copy.
Have a look at Git push only for bare repositories? and http://gitready.com/advanced/2009/02/01/push-to-only-bare-repositories.html
To bring the non-bare remote repository up to date, connect to the machine where the repo is located via SSH and run git reset --hard HEAD
and git checkout -f
to forcefully bring the working copy up to date (note that this will destroy any local changes you might have done in that working copy).
To make your remote repository bare, connect to the machine via SSH so you can access it directly. Assuming the repository is in a subfolder repo
run the following commands:
mv repo repo_old
git clone --bare repo_old repo
Then test if everything works and after this rm -rf repo_old
to get rid of the old one.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With