使用Travis-ci构建并将一些文件/文件夹推送到另一个存储库

时间:2013-11-07 20:09:49

标签: git github travis-ci

如果有人可以看看这个并且可能指出我正确的方向。这是2天,我找不到解决方案。有一个类似的问题here,我可能会遗漏一些东西。 您可以看到travis-ci构建日志here

错误消息是:

remote: Anonymous access to JamesDullaghan/bower-foundation-css.git denied.
fatal: Authentication failed for 'https://github.com/JamesDullaghan/bower-foundation-css.git/'

.travis.yml文件

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 "myemail@email.com"
  - 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"

我已经运行travis encrypt GH_TOKEN="mytoken" --add并且我已经尝试在github中创建一个新令牌两次,看看我是否做错了。

非常感谢您在这一点上的任何帮助。

1 个答案:

答案 0 :(得分:1)

我找到了答案here,虽然它没有使用.git/credentials/文件。

总之,我们无法控制Travis-ci克隆存储库的方式。这意味着远程未使用身份验证凭据进行设置,因此我们删除了远程,并使用凭据添加远程:

cd clonedrepofolder
git remote rm origin
git remote add origin https://username:${GH_TOKEN}@github.com/username/repo.git
相关问题