2

I already followed the steps exactly specified at this link

However, I am still having the issue. My build will get stuck when accessing the private repo.

$ julia --check-bounds=yes -e 'Pkg.clone("https://github.com/xxxx/xxxx.git")'
INFO: Cloning xxxx from https://github.com/xxxx/xxxx.git
Username for 'https://github.com':
Done: Job Cancelled

Note: I manually cancel it after a few minutes of waiting. How can I get it to use the SSH key I have setup and bypass this username and password field?

Note: xxxx is used in place of the name of my project to make this post general. I have already checked out the links on Travis CI and they don't make it clear what needs to occur. Thank you!

Update: I tried to add a GitHub Token Pkg.clone("https://fake_git_hub_token@github.com/xxxx/xxxx.git") and it still prompts me to sign in with the username. I gave that token full Repo access. Also, note that I am using Travis CL Virtual Machine.

In the Travis CI docs they reference the following: Assumptions:

The repository you are running the builds for is called “myorg/main” and depends on “myorg/lib1” and “myorg/lib2”. You know the credentials for a user account that has at least read access to all three repositories. To pull in dependencies with a password, you will have to use the user name and password in the Git HTTPS URL: https://ci-user:mypassword123@github.com/myorg/lib1.git.

SOLUTION: just add TravisCIUsername:mypassword@github.com/organizer_of_the_repo/Dependancy.git In my case, I am going to make a fake admin account to run the tests since someone will have to expose their password to use this setup. Note that you can set up 2-factor authentication on the admin account such that only one person can access it even if they know the password.

logankilpatrick
  • 13,148
  • 7
  • 44
  • 125

2 Answers2

1

You need to add the SSH key to the Travis UI under an environmental variable for your desired repo. You also need to add the key to the .travis.yml file on that repo.

https://docs.travis-ci.com is the docs for Travis

Squick
  • 41
  • 4
  • I have already added it to my Travis UI. Can you provide specifics(example) as to how to add the key to the top of my .travis.yml file? I have already looked at the docs and it is not clear as to how to do this. – logankilpatrick Oct 19 '18 at 16:39
  • Actually, I have it set up right no under SSH key, can you elaborate on how I can set it up under Environment Variable? – logankilpatrick Oct 19 '18 at 16:41
  • 1
    You go to your repo that you linked with travis, click the settings tab, and its under environmental variables – Squick Oct 19 '18 at 16:58
  • 1
    Place your SSH key into the value and give it a name and click add – Squick Oct 19 '18 at 16:59
  • I see that! But what variable do I create? Do I call it SSH? or GitHub Password, etc.? – logankilpatrick Oct 19 '18 at 16:59
  • It is still getting stuck when I run the build. I have it saved in my SSH key setting, and copied it, and made an E.V. called SSH and it still stops at "username for github.com :" – logankilpatrick Oct 19 '18 at 17:06
  • 1
    Do you have a GitHub_token set up? – Squick Oct 19 '18 at 17:10
  • Let us [continue this discussion in chat](https://chat.stackoverflow.com/rooms/182159/discussion-between-logankilpatrick-and-squick). – logankilpatrick Oct 19 '18 at 17:13
0

SOLUTION: just add Travis_CI_Username:my_password@github.com/organizer_of_the_repo/Dependancy.git to the travis.yml. file.

If this is unclear, please comment and I will update, but this is how I got it to work for me(even tho I went through all the SSH key business).

In my case, I am going to make a fake admin account to run the tests since someone will have to expose their password to use this setup.

Note that you can set up 2-factor authentication on the admin account such that only one person can access it even if they know the password.

logankilpatrick
  • 13,148
  • 7
  • 44
  • 125
  • How do you add it? could you provide a sample? is it an environment variable? – Дмитри Oct 17 '19 at 13:33
  • You probably can as an ENV Var, but in my post, I was specifically talking about using it as a url. So the format I describe above is the url format to clone a repo using a SSH key. Then you can do Pkg.add(“url”) on Travis to get a private dependency. – logankilpatrick Oct 17 '19 at 14:04