Well, where should we start? First off, get connected to the remote server to have a remote access to it (you can make use of ssh, for instance). You need to have two repositories initiated on the server - one for the core and the other for the site itself. It's on this site that the Drupal core will be installed on. We will create a user named "git" just for the purposes of illustrating. The repositories' initialization will then look like this:
cd /home/git/ mkdir bare cd bare mkdir core mkdir project cd core git init --bare cd /home/git/bare/project git init --bare
Secondly, we will build a master branch in the core repository. It can be done at any testing ground once you have created a directory where core files will reside (in our instance it's /var/www/site_core), as well as have insourced the core git repository that had been created before (the remote server can be accessed through the following path ssh://[email protected]). Next we perform the first commit to create the master branch in the repository. The relevant picture will read as follows:
cd /var/www/ mkdir site_core cd site_core git clone ssh://[email protected]/home/git/bare/core ./ touch Readme.txt echo 'Core repo' > Readme.txt git add . git commit -m "Initial commit" git push origin master
Thus, we have Drupal core git repository fully initialized and on-the-go, though it still lacks the core files themselves. They should accordingly be added (mind that we are still in /var/www/site_core). The folders which can be affected in the course of elaborating the site should also be removed and placed over into .gitignore. Failing to do this will lead to putting the content of the above foulders to the initial state as soon as you have started the git submodule update command running. And that will effect removing the added modules. The foulders in question are "modules" and "sites":
git checkout -b 8.x wget http://ftp.drupal.org/files/projects/drupal-8.x-dev.tar.gz tar -xzvf drupal-8.x-dev.tar.gz -C /tmp && mv /tmp/drupal-8.x-dev/* /var/www/site_core rm -rf sites/ modules/ git add . git commit -m "Add core files" git push origin 8.x touch .gitignore echo modules > .gitignore echo sites >> .gitignore git add .gitignore git commit -m "Disalow modules and sites folders" git push