I currently am deploying a micro-service using .net standard 2.0, which either clones or updates a repo from GitLab.
For this I have a functionality that works perfectly in a Windows environment, but it does not do the trick inside a docker container after I spin it up.
if (gitFolder.GetDirectories().Length == 0)
{
try
{
// Get user credentials
Repository.Clone("repository.git", deployerPath, new CloneOptions()
{
BranchName = "develop",
CredentialsProvider = CredentialsProvider(),
});
}
catch (Exception ex)
{
...
}
}
else
{
try
{
var repository = new Repository(deployerPath);
Commands.Pull(repository,
new Signature("blah", "blah@blah.com", DateTimeOffset.Now), new PullOptions()
{
FetchOptions = new FetchOptions() {CredentialsProvider = CredentialsProvider()},
MergeOptions = new MergeOptions() {FailOnConflict = true},
});
}
...
I'd expect to see the folder containing all the sub-folders/files just like in Windows, but it is always empty. Also, the folder's timestamp gets updated when it should do the pull.
This is the info of the Linux's distro:
Linux 828ec2e85f2c 4.9.184-linuxkit #1 SMP Tue Jul 2 22:58:16 UTC 2019 x86_64 GNU/Linux
I'm seeing other issues in which they state that some init setup should take place when pulling, but at least the clone should happen (according to what I've read).
Any help is greatly appreciated.
After adding some logging I found out that this was the error message: too many redirects or authentication replays. So I went ahead and applied the solution stated for this question to make it work.