【问题标题】:Clone a git repo with credentials using gulp-git使用 gulp-git 克隆带有凭据的 git 存储库
【发布时间】:2016-07-18 19:51:19
【问题描述】:

我正在尝试通过 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
     });
});

【问题讨论】:

    标签: javascript git gulp


    【解决方案1】:

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

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

    所有关于在文件中存储明文密码并通过纯 HTTP 传输它们的常见警告当然都适用。

    【讨论】:

    • 使用您的建议,我没有收到任何错误,但测试目录仍然是空的,并且克隆在 8.21 毫秒内完成
    • 好的,已排序..这是错误的 './test' ..它应该是 'myfolder/test' -- 谢谢
    猜你喜欢
    • 2016-08-15
    • 2017-08-07
    • 1970-01-01
    • 1970-01-01
    • 2013-07-14
    • 1970-01-01
    • 1970-01-01
    • 2018-06-20
    • 1970-01-01
    相关资源
    最近更新 更多