Upgrading Magento via SSH is usually much simpler than via the magento downloader. To upgrade follow these simple steps.

1. First backup. Download a copy of your database, and backup your files. You can make a zip of them.

2. Set the permissions for mage:
chmod +x mage

3. Run mage-setup and sync:
./mage mage-setup .
./mage sync

4. Upgrade Magento:
./mage upgrade-all --force

If that doesn’t work, try:
./mage install http://connect20.magentocommerce.com/community Mage_All_Latest --force

5. It’s always a good idea to run the indexer and clear the cache:
php shell/indexer.php reindexall
rm -rf downloader/.cache/ var/cache/

You’re all done (as long as there were no errors.