Created Setting up Git (markdown)

Theodotos Andreou 2018-01-14 15:23:45 +02:00
parent ce60906fe0
commit 9114489d46

88
Setting-up-Git.md Normal file

@ -0,0 +1,88 @@
In this guide we are using Github to post our website.
## Prerequisites
* Create an empty repository on your Github account
## Install git
```
$ sudo apt -y install git
```
## Initilaze git for *webadmin*
```
$ git config --global user.name "Theodotos Andreou"
$ git config --global user.email theo@ubuntucy.org
```
Generate an SSH key pair for *webadmin*:
```
$ ssh-keygen
Generating public/private rsa key pair.
Enter file in which to save the key (/srv/webadmin/.ssh/id_rsa):
Created directory '/srv/webadmin/.ssh'.
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /srv/webadmin/.ssh/id_rsa.
Your public key has been saved in /srv/webadmin/.ssh/id_rsa.pub.
The key fingerprint is:
93:25:fe:10:24:d3:d7:4a:fa:a0:92:62:b7:47:12:93 webadmin@task1
The key's randomart image is:
+---[RSA 2048]----+
| o.. . |
| +. o . |
| . o+.. |
| E .o=. |
| + .So |
| o = o +. |
| . o = . |
| . . |
| . |
+-----------------+
```
Upload the contents of *~/.ssh/ip_rsa.pub* to the relevant Github repo:
```
$ cat ~/.ssh/id_rsa.pub
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDpuS1ylG2p9Uv+9tT23ofGZ88TuFJkYr3Ec06A8mGe/n3lrBpTP6G/mxi/Z8USFj2DO9o3KJfn/y6blc3jcFmqsSAPYh60Jst0E9P4RfXfcN6qU7FIg3RLNC45O/zyvF1WgSZOGM5m1799w6Cjw6+cj/3izYov+toF0ghZPkPC8cwbppWIVpSt3I4y2NYFHDnl29ihV/oN4RjSwi4eUPI/W3mxQwaGccz5TVwXYcywrJm0/UkxoSFSl9eppydjUT9NSgcvH3mH0G5hXGTZyjXGMeQqojW1QjRaElvjEErx7OEUjLV7qhav42AFPH0eC/aDGXnkxDdJlNhMSVO75md/ webadmin@cms
```
## Initialize the *cms* directory
Run the commands as the *webadmin* user:
```
$ cd cms
$ git init
```
Edit the auto-generated *.gitignore* file, like this:
```
# Ignore configuration files that may contain sensitive information.
sites/*/settings.php
sites/*/civicrm.settings.php
# Ignore paths that contain user-generated content.
sites/*/files
sites/*/private
```
Proceed with the initialization:
```
$ git add .
$ git commit -m "First commit"
$ git remote add origin git@github.com:username/drupal-civicrm.git
$ git push origin master
```
Now check your Github repo to see the uploaded files.
References
* https://git-scm.com/book/en/v2/Getting-Started-First-Time-Git-Setup
* https://help.github.com/articles/adding-an-existing-project-to-github-using-the-command-line/