I am trying to use the git api to get a file from my repo without success. Can you give me some pointers? Is an lsfconfig, which I do not have, needed?
When I run my below C# code, I get this response
{
“message”: “Access forbidden. Check your access level.”,
“documentation_url”: “https://gitlab.com/help”
}
I am positive that I am passing my correct credentials.
C# code follows:
HttpClient client = new HttpClient();
client.DefaultRequestHeaders.Accept.Add(new System.Net.Http.Headers.MediaTypeWithQualityHeaderValue("application/vnd.git-lfs+json"));
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Basic",
Convert.ToBase64String(
System.Text.ASCIIEncoding.ASCII.GetBytes(
string.Format("{0}:{1}", <my_username>, <my_password>))));
string json = @"{
'operation': 'download',
'transfers': [ 'basic' ],
'ref': { 'name': 'refs/heads/master' },
'objects': [
{
'oid': '9669a62bbe8d8150c11d814509078b5db8f73c97ecfc94beb1dc6b22130adf7b',
'size': 4465559,
'authenticated': true
}
]
}";
var response = client.PostAsync("https://gitlab.com/<my_repo>/info/lfs/objects/batch", new StringContent(JsonConvert.SerializeObject(json), Encoding.UTF8, "application/json"));