尝试使用以下R代码从TFS 2015上托管的git存储库中安装R包
<table id="tableReport" class="table table-striped table-hover">
<colgroup>
<col style="width: 7%" />
<col style="width: 7%" />
<col style="width: 7%" />
<col style="width: 7%" />
<col style="width: 7%" />
<col style="width: 7%" />
<col style="width: 7%" />
<col style="width: 7%" />
<col style="width: 7%" />
<col style="width: 7%" />
<col style="width: 7%" />
<col style="width: 7%" />
<col style="width: 7%" />
</colgroup>
<thead>
<tr>
<th>Event Name</th>
<th>Start Date</th>
<th>End Date</th>
<th>Peoplesoft_ID</th>
<th>First Name</th>
<th>Last Name</th>
<th>Workday_ID</th>
<th>District Name</th>
<th>District Code</th>
<th>Donation Date</th>
<th>Amount</th>
<th>Recurring Periods</th>
<th>Gift</th>
</tr>
</thead>
<tr>
<td>Easter Event</td>
<td>Hardcoded Test</td>
<td>Hardcoded Test</td>
<td>Hardcoded Test</td>
<td>Hardcoded Test</td>
<td>Hardcoded Test</td>
<td>Hardcoded Test</td>
<td>Hardcoded Test</td>
<td>Hardcoded Test</td>
<td>Hardcoded Test</td>
<td>Hardcoded Test</td>
<td>Hardcoded Test</td>
<td>Hardcoded Test</td>
</tr>
</table>
<script type="text/javascript" language="javascript">
function loadFunction() {
var value_id = $('#myhidden').val();
alert(value_id);
$.ajax({
type: 'POST',
dataType: 'json',
contentType: 'application/json; charset=utf-8',
url: '/Admin/ShowEventJSON',
data: '{ value_id:' + JSON.stringify(value_id) + '}',
success: function (data) {
createReport(data)
},
error: function () { alert('ajax request error') }
});
}
//$('#example').DataTable({
// dom: 'Bbfrtip',
// buttons: [
// 'copy'
// ]
//});
//$(document).ready(function () {
// $('#tableReport').DataTable({
// dom: 'Bbfrtip',
// buttons: [
// 'excelHtml5',
// ]
// });
//});
//Function to populate table
function createReport(data) {
var myObj = JSON.parse(data);
var table = document.getElementById("tableReport");
for (var i in myObj) {
var row = document.createElement('tr');
var valuesArray = Object.values(myObj[i]);
for (var v in valuesArray) {
var cell = document.createElement('td');
var cellValue = document.createTextNode(valuesArray[v]);
cell.appendChild(cellValue);
row.appendChild(cell);
}
table.appendChild(row);
}
$(document).ready(function () {
$('#tableReport').DataTable({
dom: 'Bbfrtip',
buttons: [
'excelHtml5',
]
});
});
}
</script>
在
中执行上述结果install.packages("devtools")
creds <- git2r::cred_user_pass("AD_USER_ID", "password")
url <- "http://tfs_server/tfs/Collection/Project/_git/RepoName"
devtools::install_git(url, build_vignettes = TRUE, credentials = creds)
我已确认可以使用凭据从命令行克隆存储库。
也尝试过
Downloading git repo http://tfs_server/tfs/Collection/Project/_git/RepoName
Installation failed: Error in 'git2r_clone': unexpected HTTP status code: 401
根据@Dason的建议尝试
url <- "http://AD_USER_ID:password@tfs_server/tfs/Collection/Project/_git/RepoName"
得到
git2r::clone(url, local_path="./Test", credentials = creds)
好像git2r无法将凭据传递到服务器
我如何通过凭据?