Reputation: 1350
If anyone can take a look at this and maybe point me in the right direction. It's been 2 days and I can't find a solution. There is a similar issue here, and I may be missing something. You can see the travis-ci build log here
The error message is:
remote: Anonymous access to JamesDullaghan/bower-foundation-css.git denied.
fatal: Authentication failed for 'https://github.com/JamesDullaghan/bower-foundation-css.git/'
.travis.yml file
language: node_js
node_js:
- '0.10'
env:
global:
- secure: some-long-string-of-characters-numbers
branches:
only:
- somebranch
before_script:
- echo -e "Host github.com\n\tStrictHostKeyChecking no\n" >> ~/.ssh/config
- git config --global user.email "[email protected]"
- git config --global user.name "myname"
- git config credential.helper "store --file=~/.git/credentials"
- echo "https://${GH_TOKEN}:@github.com" > ~/.git/credentials
script:
- npm install grunt
- npm install grunt-cli
- grunt compile
after_success:
- git clone https://github.com/myname/repo2.git
- cp -r dist/assets/* repo2/
- cd repo2
- git add .
- git commit -m "build to repo2"
- git push -fq origin master
- echo -e "Done with magic\n"
I have run travis encrypt GH_TOKEN="mytoken" --add
and I've tried creating a new token in github twice to see if I was doing that incorrectly.
Any help at this point is greatly appreciated.
Upvotes: 1
Views: 3468
Reputation: 1350
I found the answer here, although it's not using the .git/credentials/
file.
In summary, we can't control the way Travis-ci clones the repository. This means the remote isn't setup with authentication credentials, so we remove the remote, and add the remote with credentials:
cd clonedrepofolder
git remote rm origin
git remote add origin https://username:${GH_TOKEN}@github.com/username/repo.git
Upvotes: 1