Git repo cannot be accessed











up vote
-1
down vote

favorite












I've got a very strange issue with Ansible since last friday. We've been using Ansible with Jenkins for about 1.5 year to Build and Deploy our code. But, since last friday we're getting the following error when Ansible tries to pull the Git repo.



"Git repo Git@GitHub.com: User/reponame.git cannot be accessed".



I don't think this is a Jenkins error because, when I run the script on the command line, I'm also getting this error. The Ansible we use, is based on Trellis from Roots. The YAML file used is the following:



---
- include: "{{ deploy_update_before | default('../hooks/example.yml') }}"
tags: deploy-update-before

- name: Check whether project source path is a git repo
stat:
path: "{{ project_source_path }}/.git"
register: git_project

- name: Get current git remote URL
command: git config --get remote.origin.url
args:
chdir: "{{ project_source_path }}"
register: remote_origin_url
when: git_project.stat.exists
changed_when: false

- name: Update git remote URL
command: git remote set-url origin {{ project_git_repo }}
args:
chdir: "{{ project_source_path }}"
when: git_project.stat.exists and remote_origin_url.stdout != project_git_repo

- name: Clone project files
git:
repo: "{{ project_git_repo }}"
dest: "{{ project_source_path }}"
version: "{{ project_version }}"
accept_hostkey: yes
ignore_errors: true
no_log: false
register: git_clone

- name: Failed connection to remote repo
fail:
msg: |
Git repo {{ project.repo }} cannot be accessed. Please verify the repository exists and you have SSH forwarding set up correctly.
More info:
> https://roots.io/trellis/docs/deploys/#ssh-keys
> https://roots.io/trellis/docs/ssh-keys/#cloning-remote-repo-using-ssh-agent-forwarding
when: git_clone | failed

- include: "{{ deploy_update_after | default('../hooks/example.yml') }}"
tags: deploy-update-after


When I run the following command on the command line while logged in as the user 'jenkins', everything seems to be perfectly fine:



ssh -T git@github.com



Hi User/reponame.git You've successfully authenticated, but GitHub does not provide shell access.




Also, cloning works as expected.



$ mkdir test && cd test && git clone git@github.com:User/reponame.git


The output is:



Cloning into 'reponame'...
remote: Enumerating objects: 975, done.
remote: Counting objects: 100% (975/975), done.
remote: Compressing objects: 100% (554/554), done.
remote: Total 83485 (delta 701), reused 615 (delta 412), pack-reused 82510
Receiving objects: 100% (83485/83485), 338.98 MiB | 21.21 MiB/s, done.
Resolving deltas: 100% (55561/55561), done.


I've already checked and executed the steps on the following pages:
https://roots.io/trellis/docs/deploys/#ssh-keys
https://roots.io/trellis/docs/ssh-keys/#cloning-remote-repo-using-ssh-agent-forwarding



Can someone tell me what's going wrong?



FIXED - Git repo cannot be accessed with Ansible and Jenkins



I've got a very strange issue with Ansible since last friday. We've been using Ansible with Jenkins for about 1.5 year to Build and Deploy our code. But, since last friday we're getting the following error when Ansible tries to pull the GIT repo.



"Git repo git@github.com:User/reponame.git cannot be accessed".



I don't think this is a Jenkins error because, when I run the script on the command line, i'm also getting this error. The Ansible we use, is based on Trellis from Roots. The YAML file used is the following:



When i run the following command on the command line while logged in as the user 'jenkins', everything seems to be perfectly fine:



Hi User/reponame.git You've successfully authenticated, but GitHub does not provide shell access.



Can someone tell me what's going wrong?



Thanks in advance!



EDIT: It's fixed. Github made some changes to their IP addresses, our host didn't whitelist them ;-).










share|improve this question




























    up vote
    -1
    down vote

    favorite












    I've got a very strange issue with Ansible since last friday. We've been using Ansible with Jenkins for about 1.5 year to Build and Deploy our code. But, since last friday we're getting the following error when Ansible tries to pull the Git repo.



    "Git repo Git@GitHub.com: User/reponame.git cannot be accessed".



    I don't think this is a Jenkins error because, when I run the script on the command line, I'm also getting this error. The Ansible we use, is based on Trellis from Roots. The YAML file used is the following:



    ---
    - include: "{{ deploy_update_before | default('../hooks/example.yml') }}"
    tags: deploy-update-before

    - name: Check whether project source path is a git repo
    stat:
    path: "{{ project_source_path }}/.git"
    register: git_project

    - name: Get current git remote URL
    command: git config --get remote.origin.url
    args:
    chdir: "{{ project_source_path }}"
    register: remote_origin_url
    when: git_project.stat.exists
    changed_when: false

    - name: Update git remote URL
    command: git remote set-url origin {{ project_git_repo }}
    args:
    chdir: "{{ project_source_path }}"
    when: git_project.stat.exists and remote_origin_url.stdout != project_git_repo

    - name: Clone project files
    git:
    repo: "{{ project_git_repo }}"
    dest: "{{ project_source_path }}"
    version: "{{ project_version }}"
    accept_hostkey: yes
    ignore_errors: true
    no_log: false
    register: git_clone

    - name: Failed connection to remote repo
    fail:
    msg: |
    Git repo {{ project.repo }} cannot be accessed. Please verify the repository exists and you have SSH forwarding set up correctly.
    More info:
    > https://roots.io/trellis/docs/deploys/#ssh-keys
    > https://roots.io/trellis/docs/ssh-keys/#cloning-remote-repo-using-ssh-agent-forwarding
    when: git_clone | failed

    - include: "{{ deploy_update_after | default('../hooks/example.yml') }}"
    tags: deploy-update-after


    When I run the following command on the command line while logged in as the user 'jenkins', everything seems to be perfectly fine:



    ssh -T git@github.com



    Hi User/reponame.git You've successfully authenticated, but GitHub does not provide shell access.




    Also, cloning works as expected.



    $ mkdir test && cd test && git clone git@github.com:User/reponame.git


    The output is:



    Cloning into 'reponame'...
    remote: Enumerating objects: 975, done.
    remote: Counting objects: 100% (975/975), done.
    remote: Compressing objects: 100% (554/554), done.
    remote: Total 83485 (delta 701), reused 615 (delta 412), pack-reused 82510
    Receiving objects: 100% (83485/83485), 338.98 MiB | 21.21 MiB/s, done.
    Resolving deltas: 100% (55561/55561), done.


    I've already checked and executed the steps on the following pages:
    https://roots.io/trellis/docs/deploys/#ssh-keys
    https://roots.io/trellis/docs/ssh-keys/#cloning-remote-repo-using-ssh-agent-forwarding



    Can someone tell me what's going wrong?



    FIXED - Git repo cannot be accessed with Ansible and Jenkins



    I've got a very strange issue with Ansible since last friday. We've been using Ansible with Jenkins for about 1.5 year to Build and Deploy our code. But, since last friday we're getting the following error when Ansible tries to pull the GIT repo.



    "Git repo git@github.com:User/reponame.git cannot be accessed".



    I don't think this is a Jenkins error because, when I run the script on the command line, i'm also getting this error. The Ansible we use, is based on Trellis from Roots. The YAML file used is the following:



    When i run the following command on the command line while logged in as the user 'jenkins', everything seems to be perfectly fine:



    Hi User/reponame.git You've successfully authenticated, but GitHub does not provide shell access.



    Can someone tell me what's going wrong?



    Thanks in advance!



    EDIT: It's fixed. Github made some changes to their IP addresses, our host didn't whitelist them ;-).










    share|improve this question


























      up vote
      -1
      down vote

      favorite









      up vote
      -1
      down vote

      favorite











      I've got a very strange issue with Ansible since last friday. We've been using Ansible with Jenkins for about 1.5 year to Build and Deploy our code. But, since last friday we're getting the following error when Ansible tries to pull the Git repo.



      "Git repo Git@GitHub.com: User/reponame.git cannot be accessed".



      I don't think this is a Jenkins error because, when I run the script on the command line, I'm also getting this error. The Ansible we use, is based on Trellis from Roots. The YAML file used is the following:



      ---
      - include: "{{ deploy_update_before | default('../hooks/example.yml') }}"
      tags: deploy-update-before

      - name: Check whether project source path is a git repo
      stat:
      path: "{{ project_source_path }}/.git"
      register: git_project

      - name: Get current git remote URL
      command: git config --get remote.origin.url
      args:
      chdir: "{{ project_source_path }}"
      register: remote_origin_url
      when: git_project.stat.exists
      changed_when: false

      - name: Update git remote URL
      command: git remote set-url origin {{ project_git_repo }}
      args:
      chdir: "{{ project_source_path }}"
      when: git_project.stat.exists and remote_origin_url.stdout != project_git_repo

      - name: Clone project files
      git:
      repo: "{{ project_git_repo }}"
      dest: "{{ project_source_path }}"
      version: "{{ project_version }}"
      accept_hostkey: yes
      ignore_errors: true
      no_log: false
      register: git_clone

      - name: Failed connection to remote repo
      fail:
      msg: |
      Git repo {{ project.repo }} cannot be accessed. Please verify the repository exists and you have SSH forwarding set up correctly.
      More info:
      > https://roots.io/trellis/docs/deploys/#ssh-keys
      > https://roots.io/trellis/docs/ssh-keys/#cloning-remote-repo-using-ssh-agent-forwarding
      when: git_clone | failed

      - include: "{{ deploy_update_after | default('../hooks/example.yml') }}"
      tags: deploy-update-after


      When I run the following command on the command line while logged in as the user 'jenkins', everything seems to be perfectly fine:



      ssh -T git@github.com



      Hi User/reponame.git You've successfully authenticated, but GitHub does not provide shell access.




      Also, cloning works as expected.



      $ mkdir test && cd test && git clone git@github.com:User/reponame.git


      The output is:



      Cloning into 'reponame'...
      remote: Enumerating objects: 975, done.
      remote: Counting objects: 100% (975/975), done.
      remote: Compressing objects: 100% (554/554), done.
      remote: Total 83485 (delta 701), reused 615 (delta 412), pack-reused 82510
      Receiving objects: 100% (83485/83485), 338.98 MiB | 21.21 MiB/s, done.
      Resolving deltas: 100% (55561/55561), done.


      I've already checked and executed the steps on the following pages:
      https://roots.io/trellis/docs/deploys/#ssh-keys
      https://roots.io/trellis/docs/ssh-keys/#cloning-remote-repo-using-ssh-agent-forwarding



      Can someone tell me what's going wrong?



      FIXED - Git repo cannot be accessed with Ansible and Jenkins



      I've got a very strange issue with Ansible since last friday. We've been using Ansible with Jenkins for about 1.5 year to Build and Deploy our code. But, since last friday we're getting the following error when Ansible tries to pull the GIT repo.



      "Git repo git@github.com:User/reponame.git cannot be accessed".



      I don't think this is a Jenkins error because, when I run the script on the command line, i'm also getting this error. The Ansible we use, is based on Trellis from Roots. The YAML file used is the following:



      When i run the following command on the command line while logged in as the user 'jenkins', everything seems to be perfectly fine:



      Hi User/reponame.git You've successfully authenticated, but GitHub does not provide shell access.



      Can someone tell me what's going wrong?



      Thanks in advance!



      EDIT: It's fixed. Github made some changes to their IP addresses, our host didn't whitelist them ;-).










      share|improve this question















      I've got a very strange issue with Ansible since last friday. We've been using Ansible with Jenkins for about 1.5 year to Build and Deploy our code. But, since last friday we're getting the following error when Ansible tries to pull the Git repo.



      "Git repo Git@GitHub.com: User/reponame.git cannot be accessed".



      I don't think this is a Jenkins error because, when I run the script on the command line, I'm also getting this error. The Ansible we use, is based on Trellis from Roots. The YAML file used is the following:



      ---
      - include: "{{ deploy_update_before | default('../hooks/example.yml') }}"
      tags: deploy-update-before

      - name: Check whether project source path is a git repo
      stat:
      path: "{{ project_source_path }}/.git"
      register: git_project

      - name: Get current git remote URL
      command: git config --get remote.origin.url
      args:
      chdir: "{{ project_source_path }}"
      register: remote_origin_url
      when: git_project.stat.exists
      changed_when: false

      - name: Update git remote URL
      command: git remote set-url origin {{ project_git_repo }}
      args:
      chdir: "{{ project_source_path }}"
      when: git_project.stat.exists and remote_origin_url.stdout != project_git_repo

      - name: Clone project files
      git:
      repo: "{{ project_git_repo }}"
      dest: "{{ project_source_path }}"
      version: "{{ project_version }}"
      accept_hostkey: yes
      ignore_errors: true
      no_log: false
      register: git_clone

      - name: Failed connection to remote repo
      fail:
      msg: |
      Git repo {{ project.repo }} cannot be accessed. Please verify the repository exists and you have SSH forwarding set up correctly.
      More info:
      > https://roots.io/trellis/docs/deploys/#ssh-keys
      > https://roots.io/trellis/docs/ssh-keys/#cloning-remote-repo-using-ssh-agent-forwarding
      when: git_clone | failed

      - include: "{{ deploy_update_after | default('../hooks/example.yml') }}"
      tags: deploy-update-after


      When I run the following command on the command line while logged in as the user 'jenkins', everything seems to be perfectly fine:



      ssh -T git@github.com



      Hi User/reponame.git You've successfully authenticated, but GitHub does not provide shell access.




      Also, cloning works as expected.



      $ mkdir test && cd test && git clone git@github.com:User/reponame.git


      The output is:



      Cloning into 'reponame'...
      remote: Enumerating objects: 975, done.
      remote: Counting objects: 100% (975/975), done.
      remote: Compressing objects: 100% (554/554), done.
      remote: Total 83485 (delta 701), reused 615 (delta 412), pack-reused 82510
      Receiving objects: 100% (83485/83485), 338.98 MiB | 21.21 MiB/s, done.
      Resolving deltas: 100% (55561/55561), done.


      I've already checked and executed the steps on the following pages:
      https://roots.io/trellis/docs/deploys/#ssh-keys
      https://roots.io/trellis/docs/ssh-keys/#cloning-remote-repo-using-ssh-agent-forwarding



      Can someone tell me what's going wrong?



      FIXED - Git repo cannot be accessed with Ansible and Jenkins



      I've got a very strange issue with Ansible since last friday. We've been using Ansible with Jenkins for about 1.5 year to Build and Deploy our code. But, since last friday we're getting the following error when Ansible tries to pull the GIT repo.



      "Git repo git@github.com:User/reponame.git cannot be accessed".



      I don't think this is a Jenkins error because, when I run the script on the command line, i'm also getting this error. The Ansible we use, is based on Trellis from Roots. The YAML file used is the following:



      When i run the following command on the command line while logged in as the user 'jenkins', everything seems to be perfectly fine:



      Hi User/reponame.git You've successfully authenticated, but GitHub does not provide shell access.



      Can someone tell me what's going wrong?



      Thanks in advance!



      EDIT: It's fixed. Github made some changes to their IP addresses, our host didn't whitelist them ;-).







      jenkins github ssh ansible






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited yesterday









      Zoe

      10.1k73475




      10.1k73475










      asked Nov 5 at 17:48









      Danny

      44




      44





























          active

          oldest

          votes











          Your Answer






          StackExchange.ifUsing("editor", function () {
          StackExchange.using("externalEditor", function () {
          StackExchange.using("snippets", function () {
          StackExchange.snippets.init();
          });
          });
          }, "code-snippets");

          StackExchange.ready(function() {
          var channelOptions = {
          tags: "".split(" "),
          id: "1"
          };
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function() {
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled) {
          StackExchange.using("snippets", function() {
          createEditor();
          });
          }
          else {
          createEditor();
          }
          });

          function createEditor() {
          StackExchange.prepareEditor({
          heartbeatType: 'answer',
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader: {
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          },
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          });


          }
          });














           

          draft saved


          draft discarded


















          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53159587%2fgit-repo-cannot-be-accessed%23new-answer', 'question_page');
          }
          );

          Post as a guest





































          active

          oldest

          votes













          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes
















           

          draft saved


          draft discarded



















































           


          draft saved


          draft discarded














          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53159587%2fgit-repo-cannot-be-accessed%23new-answer', 'question_page');
          }
          );

          Post as a guest




















































































          這個網誌中的熱門文章

          Academy of Television Arts & Sciences

          L'Équipe

          1995 France bombings