# Install plugin from private Git repository?

**URL:** https://meta.discourse.org/t/install-plugin-from-private-git-repository/111250
**Category:** Development
**Created:** [March 8, 2019, 7:42am UTC](https://meta.discourse.org/t/install-plugin-from-private-git-repository/111250 "2019-03-08T07:42:18Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![Muthukkumar](https://avatars.discourse-cdn.com/v4/letter/m/77aa72/32.png) [@Muthukkumar](https://meta.discourse.org/u/Muthukkumar)
#### Post date: [March 8, 2019, 7:42am UTC](https://meta.discourse.org/t/install-plugin-from-private-git-repository/111250/1 "2019-03-08T07:42:18Z")

</div>

Hi All,  
I have read all the commands in Install Plugins in Discourse. But I didn’t get the result what I am looking for. I am having one issue while cloning the plugin form Azure repo. Could some one help me to fix that. Below is my app.yml file:

```plaintext
run:
  - exec: echo "Beginning of custom commands"
  - exec: cd /var/www/discourse && sudo -u discourse bundle install --deployment --without test --without development
  - exec: mkdir /root/.ssh/
  - exec: touch /root/.ssh/known_hosts
  - exec: ssh-keyscan -t rsa azure.microsoft.com > /root/.ssh/known_hosts
  - exec: echo "Host azure.microsoft.com\n\tStrictHostKeyChecking no\n" >> /root/.ssh/config
    #- exec: mkdir -p /root/.ssh
  - file:
      path: /root/.ssh/id_rsa
      chmod: 600
      contents: |
        -----BEGIN RSA PRIVATE KEY-----
        Proc-Type: 4,ENCRYPTED
        DEK-Info: AES-128-CBC,19EA4589000FE19E7F44F2E86FDA3990
        LVu2mQfE468ewQs4dbNN/VQ0ocVx
        7bxXEvdz6VDgkanHKDsadfasgqw3tfy+1Mh4VtW7iHbOORE.. etc...
		-----END RSA PRIVATE KEY-----
  - file:
      path: /root/.ssh/id_rsa.pub
      chmod: 600
      contents: ssh-rsa AAAAB3NzaC1ycadfasdfsalkfffjsggsadfdfsf My@abc-31.local
  - exec: cd $home/plugins && git clone yec-addx@vs-ssh.visualsdio.com:url-for-private-plugin
  - exec: cd $home && sudo -E -u discourse bundle exec rake db:migrate
  - exec: cd $home && rm -fr tmp/cache
  - exec: cd $home && sudo -E -u discourse bundle exec rake assets:precompile
  - exec: rm /root/.ssh/id_rsa
  - exec: rm /root/.ssh/id_rsa.pub
  - exec: echo "End of custom commands"

Error After ./launcher rebuild app
FAILED
--------------------
Pups::ExecError: cd /var/www/discourse/plugins && git clone yec-addx@vs-ssh.visudio.com:url-for-private-plugin failed with return #<Process::Status: pid 4231 exit 128>
Location of failure: /pups/lib/pups/exec_command.rb:112:in `spawn'
exec failed with the params "cd $home/plugins && git clone yec-addx@vs-ssh.visudio.com:url-for-private-plugin"

```

Could some one me to fix this issue. Many thanks in advance…

---

<div class="post-metadata">

### Author: ![merefield](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/merefield/32/176214_2.png) [@merefield](https://meta.discourse.org/u/merefield)
#### Post date: [March 8, 2019, 8:37am UTC](https://meta.discourse.org/t/install-plugin-from-private-git-repository/111250/2 "2019-03-08T08:37:29Z")

</div>

If you go to the plugins directory and run:

`git clone yec-addx@vs-ssh.visudio.com:url-for-private-plugin`

what do you get?

Specifically `url-for-private-plugin` doesn’t look like a valid path?

See:

> **[Git - git-clone Documentation](https://git-scm.com/docs/git-clone#_git_urls_a_id_urls_a)**

---

<div class="post-metadata">

### Author: ![Muthukkumar](https://avatars.discourse-cdn.com/v4/letter/m/77aa72/32.png) [@Muthukkumar](https://meta.discourse.org/u/Muthukkumar)
#### Post date: [March 8, 2019, 11:07am UTC](https://meta.discourse.org/t/install-plugin-from-private-git-repository/111250/3 "2019-03-08T11:07:24Z")

</div>

Hi Thanks for the response, that is my sample URL. I can able to clone the plugin in my VM, since I am having ssh public key in VM. But I am not able to clone the repo inside the container while run the app.yml.

If I clone it inside the plugin I am getting below details:

Cloning into ‘Community%20Plugins’…  
The authenticity of host ‘[vs-ssh.visualstudio.com](http://vs-ssh.visualstudio.com) (40.81.25.218)’ can’t be established.  
RSA key fingerprint is SHA256:ohD8VZEXGWo6Ez8GSEJQ9WpafgLFsOfLOtGGQCQo6Og.  
Are you sure you want to continue connecting (yes/no)? yes  
Warning: Permanently added ‘[vs-ssh.visualstudio.com](http://vs-ssh.visualstudio.com),40.81.25.218’ (RSA) to the list of known hosts.  
[yec-addx@vs-ssh.visualstudio.com](mailto:yec-addx@vs-ssh.visualstudio.com)’s password:

Even if I give correct password its not taking.  
Could you please suggest to fix this issue.

---

<div class="post-metadata">

### Author: ![merefield](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/merefield/32/176214_2.png) [@merefield](https://meta.discourse.org/u/merefield)
#### Post date: [March 8, 2019, 12:06pm UTC](https://meta.discourse.org/t/install-plugin-from-private-git-repository/111250/4 "2019-03-08T12:06:39Z")

</div>

Got it. So this is a private repo? Instead of username/password is there any support for access tokens?

e.g. for Github:

> **[Managing your personal access tokens - GitHub Docs](https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/managing-your-personal-access-tokens)**
>
> You can use a personal access token in place of a password when authenticating to GitHub in the command line or with the API.

Then you can use that in your git clone command like:

```plaintext
git clone https://my-access-token-code@github.com/blah/blah

```

This avoids any prompt.

Not sure if that’s supported in your repository though.

---

<div class="post-metadata">

### Author: ![pfaffman](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pfaffman/32/120154_2.png) [@pfaffman](https://meta.discourse.org/u/pfaffman)
#### Post date: [March 8, 2019, 12:52pm UTC](https://meta.discourse.org/t/install-plugin-from-private-git-repository/111250/5 "2019-03-08T12:52:16Z")

</div>

Are you saying that the ssh private key that you are using requires a password? They won’t work.

You’ll need an ssh key in the container they allows downloads without a password. The ssh keys must be in place before the container tries to download it.

---

<div class="post-metadata">

### Author: ![Muthukkumar](https://avatars.discourse-cdn.com/v4/letter/m/77aa72/32.png) [@Muthukkumar](https://meta.discourse.org/u/Muthukkumar)
#### Post date: [March 11, 2019, 4:53am UTC](https://meta.discourse.org/t/install-plugin-from-private-git-repository/111250/6 "2019-03-11T04:53:45Z")

</div>

Hi @pfaffman yes its worked. when I passed the ssh keys in app.yml I was not able to clone the plugin. But inside the plugin folder I can able to clone it.  
As per @pfaffman suggestion copied the ssh keys in volume: host/ guest: command. Then I can able to clone my private repo.  
Thanks a lot for the supports.
