public async Task PullAsync(string projectId, string branchName, int authorId) { var author = await _context.Users.SingleOrDefaultAsync(u => u.Id == authorId); var project = await _context.Projects .Include(p => p.GitCredential) .SingleOrDefaultAsync(p => p.Id == Convert.ToInt32(projectId)); var username = project.GitCredential.Login; var password = project.GitCredential.PasswordHash; string tempFolder = Path.Combine(Directory.GetCurrentDirectory(), "..\\GitTemp", Guid.NewGuid().ToString()); await _projectStructureService.ProjectStructureForGit(projectId, tempFolder); try { await AddGitToFolder(tempFolder, projectId, "gitcontainer"); File.Delete(tempFolder + $"\\ProjectFolder\\g{projectId}.zip"); _gitRepository.FetchAll(tempFolder + "\\ProjectFolder", username, password); _gitRepository.Pull(tempFolder + "\\ProjectFolder", branchName, project.GitCredential.Login, author.Email); _gitRepository.StashUntracked(tempFolder + "\\ProjectFolder"); await _projectStructureService.UpdateProjectStructureFromTempFolder(projectId, tempFolder + "\\ProjectFolder", authorId, false); await ReturnGitToBlob(tempFolder, projectId); _projectStructureService.DeleteTempFolder(tempFolder + "\\ProjectFolder\\.git"); } catch (Exception ex) { Debug.WriteLine(ex.Message); _logger.LogError(ex.Message); } finally { _projectStructureService.DeleteTempFolder(tempFolder); } }