Invalid Git repository

Trellis don’t accept my repository address:
git@github.com:Semen55338/ks-wp-site.git

Invalid Git repository.
Ensure that your site’s repo variable is defined in
group_vars/production/wordpress_sites.yml and uses the SSH format (example:
git@github.com:roots/bedrock.git)

group_vars/production/wordpress_sites.yml:

wordpress_sites:
  konstantin-sorokin.com:
    site_hosts:
      - konstantin-sorokin.com
    local_path: ../site # path targeting local Bedrock site directory (relative to Ansible root)
    repo: git@github.com:Semen55338/ks-wp-site.git
    repo_subtree_path: site # relative path to your Bedrock/WP directory in your repo
    branch: master
    multisite:
      enabled: false
    ssl:
      enabled: false
      provider: letsencrypt
    cache:
      enabled: false

Which command are you running when you receive this error? Please run it with -vvvv added and paste the output.

[artem@macbook:~/trellis-projects/konstantin-sorokin.com/trellis$] [master L|●2✚ 1]
15:43 $ ansible-playbook deploy.yml -e “site=konstantin-sorokin.com env=production” -vvvv
Using /Users/artem/trellis-projects/konstantin-sorokin.com/trellis/ansible.cfg as config file
Loaded callback output of type stdout, v2.0

PLAYBOOK: deploy.yml ***********************************************************
2 plays in deploy.yml

PLAY [Ensure necessary variables are defined] **********************************

TASK [Ensure environment is defined] *******************************************
task path: /Users/artem/trellis-projects/konstantin-sorokin.com/trellis/variable-check.yml:8
skipping: [localhost] => {“changed”: false, “skip_reason”: “Conditional check failed”, “skipped”: true}

PLAY [Deploy WP site] **********************************************************

TASK [setup] *******************************************************************
<semenov.ws> ESTABLISH SSH CONNECTION FOR USER: web
<semenov.ws> SSH: EXEC ssh -C -vvv -o ForwardAgent=yes -o ControlMaster=auto -o ControlPersist=60s -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o User=web -o ConnectTimeout=10 -o ControlPath=/Users/artem/.ansible/cp/ansible-ssh-%h-%p-%r semenov.ws ‘/bin/sh -c ‘"’"’( umask 22 && mkdir -p “echo $HOME/.ansible/tmp/ansible-tmp-1468942999.15-99595202000794” && echo “echo $HOME/.ansible/tmp/ansible-tmp-1468942999.15-99595202000794” )‘"’“‘’
<semenov.ws> PUT /var/folders/lw/4bpgcsqd4l9_5vnwmhsdffy80000gn/T/tmponyoLw TO /home/web/.ansible/tmp/ansible-tmp-1468942999.15-99595202000794/setup
<semenov.ws> SSH: EXEC sftp -b - -C -vvv -o ForwardAgent=yes -o ControlMaster=auto -o ControlPersist=60s -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o User=web -o ConnectTimeout=10 -o ControlPath=/Users/artem/.ansible/cp/ansible-ssh-%h-%p-%r ‘[semenov.ws]’
<semenov.ws> ESTABLISH SSH CONNECTION FOR USER: web
<semenov.ws> SSH: EXEC ssh -C -vvv -o ForwardAgent=yes -o ControlMaster=auto -o ControlPersist=60s -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o User=web -o ConnectTimeout=10 -o ControlPath=/Users/artem/.ansible/cp/ansible-ssh-%h-%p-%r -tt semenov.ws '/bin/sh -c '”‘“‘LANG=ru_RU.UTF-8 LC_ALL=ru_RU.UTF-8 LC_MESSAGES=ru_RU.UTF-8 /usr/bin/python /home/web/.ansible/tmp/ansible-tmp-1468942999.15-99595202000794/setup; rm -rf “/home/web/.ansible/tmp/ansible-tmp-1468942999.15-99595202000794/” > /dev/null 2>&1’”’"‘’
ok: [semenov.ws]

TASK [Ensure site is valid] ****************************************************
task path: /Users/artem/trellis-projects/konstantin-sorokin.com/trellis/deploy.yml:27
skipping: [semenov.ws] => {“changed”: false, “skip_reason”: “Conditional check failed”, “skipped”: true}

TASK [Ensure repo is valid] ****************************************************
task path: /Users/artem/trellis-projects/konstantin-sorokin.com/trellis/deploy.yml:33
System info:
Ansible 2.0.2.0; Darwin
Trellis at “Require Ansible 2.0.2 and remove deploy_helper”

Invalid Git repository.
Ensure that your site’s repo variable is defined in
group_vars/production/wordpress_sites.yml and uses the SSH format (example:
git@github.com:roots/bedrock.git)
More info:

https://roots.io/trellis/docs/deploys/

fatal: [semenov.ws]: FAILED! => {“changed”: false, “failed”: true, “invocation”: {“module_args”: {“msg”: “Invalid Git repository.\nEnsure that your site’s repo variable is defined in group_vars/production/wordpress_sites.yml and uses the SSH format (example: git@github.com:roots/bedrock.git)\nMore info:\n> https://roots.io/trellis/docs/deploys/\n”}, “module_name”: “fail”}}

NO MORE HOSTS LEFT *************************************************************
to retry, use: --limit @deploy.retry

PLAY RECAP *********************************************************************
localhost : ok=0 changed=0 unreachable=0 failed=0
semenov.ws : ok=1 changed=0 unreachable=0 failed=1

@semen55338 When I test your repo variable in the format you’ve stated above, it works.
repo: git@github.com:Semen55338/ks-wp-site.git
Of course, the variable format in your previous commits would not work.

Assuming you have this format not just in the remote repo group_vars/production/wordpress_sites.yml but also in the file on your local machine, then the error is quite surprising.

Could you insert the following into deploy.yml and run the deploy again?

  pre_tasks:
+   - debug:
+      msg: |
+         repo is {{ project.repo | default('undefined') }}
+         repo match is {{ project.repo | match(".*@.*:.*\.git") }}
+         {{ project | to_nice_yaml }}
    - name: Ensure site is valid
   ...

Please share the output with us. It should reveal what Ansible is using as the repo value.

1 Like

TASK [debug] *******************************************************************
task path: /Users/artem/trellis-projects/konstantin-sorokin.com/trellis/deploy.yml:27
repo is artem@git.semenov.ws:/repos/ksorokin
repo match is False
branch: master
cache:
enabled: false
local_path: …/site
multisite:
enabled: false
repo: artem@git.semenov.ws:/repos/ksorokin
repo_subtree_path: site
site_hosts:

All variables somehow load from staging envelopment :frowning:

1 Like

Thanks for sharing that output. I’m reasonably sure this is caused by using the semenov.ws host name in both the [production] group (hosts/production file) and the [staging] group (hosts/staging file). See if the following sorts it out:

thank you very much, I understood that I will watch