使用gulp-git克隆带有凭证的git仓库

时间:2016-03-30 16:55:06

标签: javascript git gulp

我正在尝试通过gulp-git将个人服务器中的git repo克隆到'test'文件夹中,它需要用户名和密码。不确定如何传递用户名和密码。请注意它不是github存储库

gulp.task('clone', function(){
git.clone('http://webrepo/git/mytest.git',{args:'./test'},function(err){
    if (err) throw err
     });
});

1 个答案:

答案 0 :(得分:2)

您应该可以在回购网址中指定用户名和密码:

gulp.task('clone', function(){
  git.clone('http://username:password@webrepo/git/mytest.git',
            {args:'./test'}, function(err) {
    if (err) throw err;
  });
});

关于将明文密码存储在文件中并通过普通HTTP传输它们的所有常见注意事项当然都适用。