# Git-ftp

https://github.com/git-ftp/git-ftp/blob/master/man/git-ftp.1.md



#### Configuration:

```bash
$ git config git-ftp.url "sftp://ftp.sur-le-sentier.fr:22/~/httpdocs/blog/wp-content/themes/yuzu-child"

$ git config git-ftp.user sentier

$ git config git-ftp.key $HOME/.ssh/id_rsa

$ git config git-ftp.insecure 0

# $ git config git-ftp.password '#my$fancy!secret'
```

```bash
$ git config --list
git-ftp.url=sftp://ftp.sur-le-sentier.fr:22/~/httpdocs/blog/wp-content/themes/yuzu-child
git-ftp.user=sentier
git-ftp.key=/Users/bruno/.ssh/id_rsa
git-ftp.insecure=0
```

```bash
$ git config --list
git-ftp.url=sftp://ftp.cluster011.hosting.ovh.net/~/www/wordpress/wp-content/themes/toppic-child/
git-ftp.user=funnymac
git-ftp.key=/Users/bruno/.ssh/id_rsa
git-ftp.insecure=1
```

Supprimer une clé:

```bash
$ git config --unset git-ftp.url
```



#### Initialisation:

```bash
~/Sites/wordpress/wp-content/themes/yuzu-child master
❯ git ftp init -u sentier --key "$HOME/.ssh/id_rsa" "sftp://ftp.sur-le-sentier.fr/~/httpdocs/blog/wp-content/themes/yuzu-child/"

# !!! Le dossier yuzu-child doit exister
```

ou 

```bash
~/Sites/wordpress/wp-content/themes/toppic-child
❯ git ftp init
12 files to sync:
[1 of 12] Buffered for upload 'formats/single-post/post-meta.php'.
[2 of 12] Buffered for upload 'functions.php'.
[3 of 12] Buffered for upload 'header.php'.
[4 of 12] Buffered for upload 'languages/fr_FR.mo'.
[5 of 12] Buffered for upload 'languages/fr_FR.po'.
[6 of 12] Buffered for upload 'languages/toppic-child.pot'.
[7 of 12] Buffered for upload 'page-ce-mois-ci.php'.
[8 of 12] Buffered for upload 'page-livre.php'.
[9 of 12] Buffered for upload 'screenshot.png'.
[10 of 12] Buffered for upload 'single-post.php'.
[11 of 12] Buffered for upload 'style 2.css'.
[12 of 12] Buffered for upload 'style.css'.
Uploading ...
Last deployment changed from  to 35086dbd0ad8f13b34ac4c0c9499299a74ae69e2.
```



#### Envoyer les nouveaux commits:

```bash
~/Sites/wordpress/wp-content/themes/yuzu-child master
❯ git ftp push -u sentier --key "$HOME/.ssh/id_rsa" "sftp://ftp.sur-le-sentier.fr/~/httpdocs/blog/wp-content/themes/yuzu-child/"
No changed files for ftp.sur-le-sentier.fr/~/httpdocs/blog/wp-content/themes/yuzu-child/. Everything up-to-date.

```



#### Fichiers à ignorer:

```bash
$ nano .git-ftp-ignore

.gitignore
*/.gitignore      # ignore files in sub directories
*/.gitkeep
.git-ftp-ignore
.git-ftp-include
.gitlab-ci.yml
```

