====== GIT access for Simple Hosting ====== ===== Prerequisites ===== * git access is intended for use by those familiar with the git version control system. We recommend that you read applicable git documentation to be sure that you use this access correctly. * **{vhost}** == a vhost created on your instance * **{login}** == your unique login. This is a number with several digits that was sent to you during the creation of your instance, and which you can also see from your instance's management page. This is not your Gandi handle. It is the same login as the one you use for your sftp, administration, and SSH console access for example. * **{datacenter_location}** == where your instance is located: dc0 for Paris, dc1 for Baltimore, dc2 for Luxembourg The **{vhost}**, **{login}** and **{datacenter_location}** parameters are visible in the tooltip when hovering over the git "Login" link on the instance control panel. ===== Create a repository ===== For the moment, we are imposing a limit of one repository per vhost. here is a small example to be tested on your local machine: $ mkdir {vhost} $ cd {vhost} $ git init $ git remote add origin ssh+git://{login}@git.{datacenter_location}.gpaas.net/{vhost}.git $ mkdir htdocs $ echo "Hello world" > htdocs/index.html $ git add htdocs $ git commit -m "first version of index.html" htdocs $ git push origin master Once the repository has been created, you will be able to see it in your Simple Hosting administration interface via the tool, //gitweb//. If this is your first repository, you will need to reboot your instance so that you can see it in your instance's administration interface. ===== The htdocs directory ===== For instances using PHP, the root of your repository is not the directory used by the web server. Consequently, in order for all your files to be accessible, you must put them in the directory called //htdocs//, placed at the root of your repository. ===== Clone a repository ===== This command will let you copy the repository to your local machine. $ git clone ssh+git://{login}@git.{datacenter_location}.gpaas.net/{vhost}.git ===== Deploy your code ===== This command will perform a [[http://git-scm.com/docs/git-checkout|git checkout]] in your vhost directory and thus deploy your code. You also have the option of specifying a git object as a tag for example. $ ssh {login}@git.{datacenter_location}.gpaas.net 'deploy {vhost}.git [ {git_object} ]' The use of [[http://git-scm.com/book/en/Git-Tools-Submodules|Git submodules]] is not supported at the moment. The directories already present in 'htdocs' of your virtualhost must at least have the same write access of the user, so that the files can be replaced during the deployment (ie. 'chmod 644'). This action is to be carried our if you encounter an error like: error: unable to unlink old 'htdocs/sites/default/settings.php' (Permission denied) Additionally, you may clean up your vhost directory. This command will execute a [[http://git-scm.com/docs/git-clean|git clean]] operation on your directory. This command will delete all files that are not followed by git! $ ssh {login}@git.{datacenter_location}.gpaas.net 'clean {vhost}.git' If you would like to keep some files or directories, even if they are not followed by git, you will need to add a list of them in a file, //.gitignore// that is placed in the root directory of your repository. This is useful, for example, if you have files created by your website. ===== Access method ===== You may either use your usual password to access your repositories (the same as the one you use for your sftp, administration, and SSH console access for example), or add your public SSH key to your disk ([[en:simple:ssh_key|more on this]]). =====Delete a repository===== In order to delete a repository, you can directly delete the directory /lamp0/vcs/git/{vhost}.git (/lamp0/vcs/git/default.git with Node.js and Python instance family) through the sftp. ===== With the Node.js / Python or Ruby instance family ===== For these instances, there is a single directory //default// in your vhosts, as well as a URL like this ssh+git://{login}@git.{datacenter_location}.gpaas.net/default.git Each deployment (see the deploy command) will automatically reboot the node process dedicated to getting the requests. The dependencies of your application will also be updated. Additionally, it is no longer necessary to have a //htdocs// directory like with the PHP instances. ===== For Windows ===== We are going to soon add documentation for accessing Git via Windows by using 'msysgit' : [[http://msysgit.github.com/]] A tutorial exists for this at the following address: [[http://guides.beanstalkapp.com/version-control/git-on-windows.html]] ===== SSH Key Fingerprint ===== The SSH key fingerprint for the git endpoint is : 35:e0:5a:a9:54:12:55:6b:ce:41:8c:c1:9e:35:1d:f6 ===== See also===== * [[http://git-scm.com/|the git website]] * [[http://git-scm.com/book/en/|git documentation]]