使用gulp-git克隆具有凭据的git repo

Clone a git repo with credentials using gulp-git

本文关键字:git repo gulp-git 使用      更新时间:2023-10-15

我正试图通过gull git从个人服务器克隆一个git repo到"test"文件夹中,它需要用户名和密码。不知道如何传递用户名和密码。请注意,它不是github存储库

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

您应该能够在回购URL中指定用户名和密码:

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

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