git-tfs returns "(401) unauthorized" error when cloning a repository - git-tfs

I used git-tfs to work with a TFVC repository. I started working on other project and the project's code is hosted on a different server.
Now I get errors when I try to clone the repository.
git tfs clone http://tfs-server:8080/tfs $/CompanyName/Dev
It prompts me to enter the credentials twice. Then it shows an error.
TF30063: You are not authorized to access http://tfs-server:8080/tfs.
The remote server returned an error: (401) Unauthorized.
I've double checked it is a correct url. I can connect with Visual Studio and with a browser.
I've double checked it is a correct password and username. I can log in with this credentials in a browser.
I am able to clone the code from a different server on my machine.
The server is Visual Studio Team Foundation Server 2013. My git-tfs version is
git-tfs version 0.21.0.0 (TFS client library 12.0.0.0 (MS)) (64-bit)
I've found a few questions with a similar error and tried the answers. So these are things I tried to do:
Logging off from this server in Visual Studio's browser;
Cleaning Internet Explorer cache
Deleting C:\Users\UserName\AppData\Local\Microsoft\Team Foundation\5.0\Cache folder;
Adding tfs server to local intranet security zone in Internet Explorer.
This is the debug output:
git tfs clone http://tfs-server:8080/tfs $/CompanyName/Dev --debug
Command run:git tfs clone http://tfs-server:8080/tfs $/CompanyName/Dev --debug
No authors file used.
git-tfs version 0.21.0.0 (TFS client library 12.0.0.0 (MS)) (64-bit)
git command: Starting process: git init
Initialized empty Git repository in C:/Users/UserName/Dev/.git/
git command time: [00:00:00.0660000] init
System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> Microsoft.TeamFoundation.TeamFoundationServerUnauthorizedException: TF30063: You are not authorized to access http://tfs-server:8080/tfs. ---> System.Net.WebException: The remote server returned an error: (401) Unauthorized.
at System.Net.HttpWebRequest.GetResponse()
at Microsoft.TeamFoundation.Client.Channels.TfsHttpWebRequest.SendRequestAndGetResponse(HttpWebRequest webRequest, WebException& webException)
--- End of inner exception stack trace ---
at Microsoft.TeamFoundation.Client.Channels.TfsHttpWebRequest.ReadResponse(HttpWebResponse webResponse, WebException webException)
at Microsoft.TeamFoundation.Client.Channels.TfsHttpWebRequest.SendRequest()
at Microsoft.TeamFoundation.Client.Channels.TfsHttpRequestChannel.Request(TfsMessage message, TimeSpan timeout)
at Microsoft.TeamFoundation.Client.Channels.TfsHttpClientBase.Invoke(TfsClientOperation operation, Object[] parameters, TimeSpan timeout, Object[]& outputs)
at Microsoft.TeamFoundation.Framework.Client.RegistrationProxy.GetRegistrationEntries(String toolId)
at Microsoft.TeamFoundation.Framework.Client.RegistrationService.GetInstanceId()
at Microsoft.TeamFoundation.Framework.Client.RegistrationService.get_InstanceClientCacheDirectory()
at Microsoft.TeamFoundation.Framework.Client.RegistrationService..ctor(TfsTeamProjectCollection tfsObject)
at Microsoft.TeamFoundation.Client.TfsTeamProjectCollection.CreateServiceProxy(Type serviceType)
at Microsoft.TeamFoundation.Client.TfsConnection.GetService(Type serviceType)
at Microsoft.TeamFoundation.Framework.Client.PreFrameworkServerDataProvider.FindServiceLocation(String serviceType, String toolId)
at Microsoft.TeamFoundation.Framework.Client.PreFrameworkServerDataProvider.LocationForCurrentConnection(String serviceType, Guid serviceIdentifier)
at Microsoft.TeamFoundation.Client.TfsConnection.EnsureProviderConnected()
at Microsoft.TeamFoundation.Client.TfsConnection.EnsureAuthenticated()
at Sep.Git.Tfs.VsCommon.TfsHelperBase.EnsureAuthenticated()
at Sep.Git.Tfs.Core.GitTfsRemote.EnsureTfsAuthenticated()
at Sep.Git.Tfs.Core.GitRepository.CreateTfsRemote(RemoteInfo remote, String autocrlf, String ignorecase)
at Sep.Git.Tfs.Commands.Init.Run(String tfsUrl, String tfsRepositoryPath)
at Sep.Git.Tfs.Commands.Clone.Run(String tfsUrl, String tfsRepositoryPath, String gitRepositoryPath)
--- End of inner exception stack trace ---
at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor)
at System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(Object obj, Object[] parameters, Object[] arguments)
at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
at Sep.Git.Tfs.Util.GitTfsCommandRunner.Run(GitTfsCommand command, IList`1 args)
at Sep.Git.Tfs.GitTfs.Main(GitTfsCommand command, IList`1 unparsedArgs)
at Sep.Git.Tfs.Program.Main(String[] args)
TF30063: You are not authorized to access http://tfs-server:8080/tfs.
The remote server returned an error: (401) Unauthorized.
What can I do to get my git-tfs flow back?

I've added collection name to the server's url and it worked.
The correct command was:
git tfs clone http://tfs-server:8080/tfs/collectionName $/CompanyName/Dev
Although the command in the question worked for the previous server.

Related

why does DNN9 installation wizard return with an error

I have been trying to install DNN9.9.0
After the installation wizard opens and I fill out the form, an error is returned stating "Server Error in "/" Application. Object reference not set to an instance of an object", with the following stack trace:
[NullReferenceException: Object reference not set to an instance of an object.]
DotNetNuke.HttpModules.OutputCaching.OutputCacheModule.OnResolveRequestCache(Object sender, EventArgs e) +678
System.Web.SyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +222
System.Web.HttpApplication.ExecuteStepImpl(IExecutionStep step) +219
System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +93
what could the issue be? and how can i resolve it?
It is not obvious.
You might want to try doing the installation on a test server using nvQuickSite (nvquicksite.com) and compare how that installation in done relative to yours.
In the meantime, make sure that you UNBLOCKED the zip file before copying its contents to your website folder. Also, verify file permissions - the IIS Worker Task needs to have full permissions for the website directory.

SonarQube.Old.Bootstrapper has stopped working

I got this crash while executing command: SonarQube.Scanner.MSBuild.exe end:
SonarQube.Old.Bootstrapper has stopped working
More logs:
enter code here SonarQube Scanner for MSBuild 2.3.1
Default properties file was found at C:\SonarQube\SonarQube.Analysis.xml
Loading analysis properties from C:\SonarQube\SonarQube.Analysis.xml
Post-processing started.
Unhandled Exception: System.NullReferenceException: Object reference not set to an instance of an object.
at SonarScanner.Shim.PropertiesWriter.WriteSettingsForProject(ProjectInfo project, IEnumerable`1 files, String fxCopReportFilePath, String codeCoverageFilePath)
at SonarScanner.Shim.PropertiesFileGenerator.ProcessProjectInfoFiles(IEnumerable`1 projects, PropertiesWriter writer, ILogger logger, String projectBaseDir, String globalSourceEncoding)
at SonarScanner.Shim.PropertiesFileGenerator.GenerateFile(AnalysisConfig config, ILogger logger, IRoslynV1SarifFixer fixer)
at SonarScanner.Shim.SonarScannerWrapper.Execute(AnalysisConfig config, IEnumerable`1 userCmdLineArguments, ILogger logger)
at
SonarQube.TeamBuild.PostProcessor.MSBuildPostProcessor.InvokeSonarScanner(IAnalysisPropertyProvider cmdLineArgs, AnalysisConfig config)
at
SonarQube.TeamBuild.PostProcessor.MSBuildPostProcessor.Execute(String[]args, AnalysisConfig config, ITeamBuildSettings settings)
at SonarQube.Bootstrapper.BootstrapperClass.PostProcess()
at SonarQube.Bootstrapper.BootstrapperClass.Execute()
at SonarQube.Bootstrapper.Program.Execute(String[] args, ILogger logger)
at SonarQube.Bootstrapper.Program.Main(String[] args)
I had the exact same issue. I found a link (Unfortunately I cannot find it again), saying that its because sonar cannot derive the source file encoding.
I added the Sonar.SourceEncoding=UTF8 property, and everything went by, just fine.

sonar qube begin task failing - Unexpected exit code received from batch file: -532462766

I m getting below error while starting sonar analysis in tfs build task.
Please Help !
*************************************************************************
Starting task: Fetch the Quality Profile from SonarQube
******************************************************************************
Executing the powershell script:
D:\kannappan_sonar\tasks\SonarQubePreBuild\1.0.35\SonarQubePreBuild.ps1 SonarQube Scanner for MSBuild 1.1
Default properties file was found at D:\kannappan_sonar\tasks\SonarQubePreBuild\1.0.35\MSBuild.SonarQube.Runner-1.1\SonarQube.Analysis.xml
Loading analysis properties from D:\kannappan_sonar\tasks\SonarQubePreBuild\1.0.35\MSBuild.SonarQube.Runner-1.1\SonarQube.Analysis.xml
Pre-processing started.
Preparing working directories...
Checking for updates...
Unhandled Exception: System.Net.WebException: The remote server returned an error: (401) Unauthorized.
at System.Net.WebClient.DownloadDataInternal(Uri address, WebRequest& request)
at System.Net.WebClient.DownloadString(Uri address)
at System.Net.WebClient.DownloadString(String address)
at SonarQube.TeamBuild.PreProcessor.WebClientDownloader.Download(String url)
at SonarQube.TeamBuild.PreProcessor.SonarWebService.GetProperties(String projectKey, String projectBranch)
at SonarQube.TeamBuild.PreProcessor.TeamBuildPreProcessor.FetchArgumentsAndRulesets(ISonarQubeServer server, ProcessedArgs args, TeamBuildSettings settings, IDictionary`2& serverSettings, List`1& analyzersSettings)
at SonarQube.TeamBuild.PreProcessor.TeamBuildPreProcessor.DoExecute(ProcessedArgs args)
at SonarQube.TeamBuild.PreProcessor.TeamBuildPreProcessor.Execute(String[] args)
at SonarQube.TeamBuild.PreProcessor.Program.Main(String[] args) SonarQube Scanner for MSBuild Begin Step 2.2 18:11:45.209 Loading analysis properties from D:\kannappan_sonar\tasks\SonarQubePreBuild\1.0.35\MSBuild.SonarQube.Runner-1.1\SonarQube.Analysis.xml 18:11:45.271 Updating build integration targets... 18:11:45.286 Fetching analysis configuration settings... Pre-processing succeeded.
Unexpected exit code received from batch file: -532462766
The crux of this error is: The remote server returned an error: (401) Unauthorized
It is likely that you're trying to analyze a project on which the permissions have been restricted. In both the begin and end steps, you'll need to pass an analysis token from an account with permissions to analyze the project.

TFS Error Publishing Log Files to non existent directory

My Build Server has been running just fine for a couple months and then this week we started getting this problem (see below).
It's almost certainly a permission problem, but no one in IT will admit to having changed a permission somewhere.
Also, it's trying to publish a log file to a location that doesn't exist!
to '#/416/logs/msbuild/agent-2'
If I knew where this location was, I would happily fix it or turn this specific publish off. All the other logs are present and accessible (obviously I'm able to view the log of these errors).
using Visual Studio 2013 & TFS2013.
This is the same issue, but changing the drop folders didn't fix it:
TFS Error publishing log files to #/198/logs/msbuild/agent-2
Other Errors and Warnings
3 error(s), 0 warning(s)
Exception Message: TF270016: An error occurred publishing log files from
'C:\Builds\2\AppName\AppName\src\AppName\AppName.log'
to '#/416/logs/msbuild/agent-2'. Details: An error occurred while
sending the request. (type PublishLogFileException) Exception Stack
Trace: at
System.Activities.Statements.Throw.Execute(CodeActivityContext
context) at
System.Activities.CodeActivity.InternalExecute(ActivityInstance
instance, ActivityExecutor executor, BookmarkManager bookmarkManager)
at
System.Activities.Runtime.ActivityExecutor.ExecuteActivityWorkItem.ExecuteBody(ActivityExecutor
executor, BookmarkManager bookmarkManager, Location resultLocation)
Inner Exception Details:
Exception Message: An error occurred while sending the request. (type
HttpRequestException) Exception Stack Trace: at
Microsoft.TeamFoundation.Build.Workflow.Activities.FileContainerDropProvider.CopyDirectory(String
sourceDirectory, String targetDirectory) at
Microsoft.TeamFoundation.Build.Workflow.Activities.FileContainerDropProvider.CopyDirectory(String
sourceDirectory, String targetDirectory, String[] renameIfExists)
at
Microsoft.TeamFoundation.Build.Workflow.Activities.PublishLogFile.Execute(CodeActivityContext
context)
Inner Exception Details:
Exception Message: Unable to connect to the remote server (type
WebException)Exception Stack Trace: at
System.Net.HttpWebRequest.EndGetResponse(IAsyncResult asyncResult)
at System.Net.Http.HttpClientHandler.GetResponseCallback(IAsyncResult
ar)
Inner Exception Details:
Exception Message: No connection could be made because the target
machine actively refused it [::1]:8080 (type SocketException)
Exception Stack Trace: at
System.Net.Sockets.Socket.EndConnect(IAsyncResult asyncResult) at
System.Net.ServicePoint.ConnectSocketInternal(Boolean connectFailure,
Socket s4, Socket s6, Socket& socket, IPAddress& address,
ConnectSocketState state, IAsyncResult asyncResult, Exception&
exception)
An error occurred while copying diagnostic activity logs
to the drop location. Details: An error occurred while sending the
request.
An error occurred while copying diagnostic activity logs to
the drop location. Details: An error occurred while sending the
request.
Update 12/29/2015
I've been able to confirm with IT that our main TFS instance was updated to 2013 Update 5.
Our build server is running TFS 2013 Update 4. My next priority will be getting the build server updated.
You can try to create a new build agent to see whether the issue persists.
The issue had nothing to do with TFS.
On the build server machine, we had a copy of Visual Studio installed (necessary for MSBuild and MSTest). The license we used had expired, and as a result Visual Studio installed in trial mode.
I don't know why this mattered, but reinstalling Visual Studio using a valid license fixed the issue.

Release management server succeeds manual, but fails automated

I'm trying to configure release management server to deploy to out test server when a specific build configuration on TFS succeeds. Now I have a build definition which runs fine, I use the build process template 'ReleaseTfvcTemplate.12.xaml'.
The 'Release Template' in Release Management Server (RMS) is set to trigger on build.
Now when I set the 'Release Build' property in the Release category to 'False', the build runs fine. Then when I go the Release Management Client and create a release, everything goes fine and my project (a WebAPI) is succesfully published to our testserver.
As soon as I set the 'Release build' property to true (in the build definition) and queue a new build, the build fails.
I receive the following error :
Exception Message: The directory name is invalid (type Win32Exception)
Exception Stack Trace: Server stack trace: at
System.Diagnostics.Process.StartWithCreateProcess(ProcessStartInfo
startInfo) at
Microsoft.TeamFoundation.Build.Workflow.Activities.InvokeProcess.ProcessWrapper.Start()
at
Microsoft.TeamFoundation.Build.Workflow.Activities.InvokeProcess.InvokeProcessInternal.RunCommand(AsyncState
state) at
System.Runtime.Remoting.Messaging.StackBuilderSink._PrivateProcessMessage(IntPtr
md, Object[] args, Object server, Object[]& outArgs) at
System.Runtime.Remoting.Messaging.StackBuilderSink.AsyncProcessMessage(IMessage
msg, IMessageSink replySink)
Exception rethrown at [0]: at
System.Runtime.Remoting.Proxies.RealProxy.EndInvokeHelper(Message
reqMsg, Boolean bProxyCase) at
System.Runtime.Remoting.Proxies.RemotingProxy.Invoke(Object NotUsed,
MessageData& msgData) at System.Func2.EndInvoke(IAsyncResult
result) at
System.Activities.AsyncCodeActivity1.System.Activities.IAsyncCodeActivity.FinishExecution(AsyncCodeActivityContext
context, IAsyncResult result) at
System.Activities.AsyncCodeActivity.CompleteAsyncCodeActivityData.CompleteAsyncCodeActivityWorkItem.Execute(ActivityExecutor
executor, BookmarkManager bookmarkManager)
The build template includes a xcopy step which may cause the "The directory name is invalid", but I don't understand why the process works manually, but not automated.
Any suggestions in the right direction are very welcome!
Make sure you have a RM Client install on the build agent machine.
Sometimes the release template can 'lose' its connection in to the build definition. To check this open the release template and use the Properties link to re-establish the connection to the build definition. In case it helps I have a soup to nuts blog post series on configuring all this - index page here.

Resources