First, before doing any below, make a tar ball backup of current code directory and get an sql dump of your current DB. Always that before doing anything with git. This provides a fall back to what you had before updating or upgrading.
Ok, what has happend ... using git according the docs provided you assumed you had no previously installed moodle code directory. Thus when you issued the git command to acquire the moodle code that automatically created a 'moodle' code directory - which now resides in the code directory you already had. So that directory has the hidden .git directory.
So since I don't know full paths to your stuff in this example below the current moodle code is in
/var/www/html/
you executed the git commands inside there
thus what was created was /var/www/html/moodle/
IF that is correct, then here's the easy fix
cd /var/www/html/moodle/
To check for the hidden git directory: ls -ld .git (note the dot in front of git)
We need to move the hidden .git directory up on level to the location of the code you already have at /var/www/html/
from /var/www/html/moodle/
cp -rp .git ../ [ENTER]
to see if that did make a copy of the hidden .git directory while still in /var/www/html/moodle/ issue: ls -d ../git
is it there? Great!
Now cd ../ to get out of the git acquired moodle directory.
Now run:
git branch -a
That command should show you what version of Moodle is being tracked according to git.
You should see:
* MOODLE_31_STABLE
remotes/origin/HEAD -> origin/master
The * indicates the version
Great! That's what we want.
Now run at /var/www/html/
git pull [ENTER]
You'll see the screen display all things git is doing .... as an example at the end might show something like this:
user/editadvanced_form.php | 2 +-
user/profile/definelib.php | 8 +-
user/profile/index.php | 2 +-
version.php | 4 +-
webservice/lib.php | 10 ++
140 files changed, 1350 insertions(+), 470 deletions(-)
create mode 100644 blocks/navigation/tests/behat/participants_link.feature
create mode 100644 lib/tests/progress_display_test.php
Check the version git has acquired. You are in /var/www/html/
fgrep '$release' version.php
You should see the highest available 3.1:
$release = '3.1.2+ (Build: 20160915)'; // Human-friendly version name
Now we are ready to update/upgrade.
You are in /var/www/html/
php admin/cli/cron.php
php admin/cli/maintenance.php --enable
php admin/cli/upgrade.php --non-interactive.php
The above will upgrade the DB
php admin/cli/maintenace.php --disable
*** important .... everything you have done might have done as the root user of your system.
Reset all files/directories to the apache user and apache group ... dunno what that is for your system but on mine ... CentOS ... that's apache:apache
So am in /var/www/html/
chown apache:apache * -R
The -R is recursive and will go down into every directory/file and change the ownerships to user apache group apache.
Now we're done.
Hit site with browser. Check to see if everything works ok.
One last thing ... remove the git acquired directory ... *** make sure you are in the right location *** following the example, you are in /var/www/html/ where the git acquire moodle directory is located.
rm -fR moodle [ENTER].
Now you are done!
'spirit of sharing' Ken