tfs - git bash cloning incorrect url with Visual Studio Team Services (VSTS) -


i have weird issue 1 of guys in office here moved on of repos 1 project in tfs (i use tfs here mean visual studio team services, tfs in cloud).

so our repo used live somewhere like:

https://somewhere.visualstudio.com/projects/_git/something

then copied project , old 1 removed, lives at:

https://somewhere.visualstudio.com/project_two/_git/something

when 1 of guys here tries clone new repo url:

git clone https://somewhere.visualstudio.com/project_two/_git/something

he gets error:

remote: tf401019: git repository name or identifier not exist or not have permissions operation attempting. fatal: repository 'https://somewhere.visualstudio.com/projects/_git/something' not found

its there cache somewhere seems redirecting new repo url old one, no longer exists. doesn't happen me on computer.

so there behind scenes in git cause repo url cached somewhere, or in tfs cause behavior?

== verbose output ==

somename@cf-l-003242 mingw64 /d/repos $ git_curl_verbose=1 git_trace=1 git clone https://somewhere.visualstudio.com/project_two/_git/something 10:50:02.761600 git.c:349               trace: built-in: git 'clone' 'https://somewhere.visualstudio.com/project_two/_git/something' cloning 'something'... 10:50:02.801600 run-command.c:336       trace: run_command: 'git-remote-https' 'origin' 'https://somewhere.visualstudio.com/projects/_git/something' 

so looks origin messed up, has uninstalled , re-installed git , cloning repo new folder don't know why mess origin.

solution

the problem global git configuration file (~/.gitconfig) had configuration origin:

[remote "origin"]     url = https://somewhere.visualstudio.com/projects/_git/something 

deleting section fixed things.

explanation

git uses configuration files store both user preferences , repository information. each repository has own configuration file (.git/config in repository directory), , there global configuration file ~/.gitconfig.

the command git config can modify these files. modifies repository configuration file default, , has flag --global modify global configuration file. files can edited using text editor.

usually, user preferences stored in global configuration file , repository information stored in per-repository file. doesn't have case though.

for example, full name , email address stored in global configuration file. if want use different email address when working in particular repository, can set email address in repository's configuration file.

conversely, repository information can stored in global configuration file provide default values repositories. can have unexpected consequences. in particular, if url of origin set globally using

git config --global remote.origin.url https://xyz  # warning: causes weirdness 

then attempt clone repository on http(s) or ssh result in https://xyz being fetched, regardless of url specified in command line (tested git 1.7.9.5 , git 2.10.2).

to fix this, open ~/.gitconfig using text editor , delete options shouldn't global. make backup first, , refer git config if aren't sure option does.

debugging notes

here steps used discover problem's cause.

the output from

git_curl_verbose=1 git_trace=1 git clone ... 

showed url correct in line 349 of git.c wrong in line 336 of run-command.c. decided run git in debugger (gdb) , see happened between 2 points.

i compiled latest version of git source debugging symbols. line numbers in question matched version downloaded, convenient (getting same version of git have been better).

when stepped through code noticed call remote_get() in line 991 of builtin/clone.c. function reads configuration, seemed place new url emerge. set remote.origin.url globally, , replicated behaviour in question.

compiling git source , stepping through in debugger not average user expected do. experienced git user might have suspected global configuration file, since survives re-installations.


Comments

Popular posts from this blog

asynchronous - C# WinSCP .NET assembly: How to upload multiple files asynchronously -

aws api gateway - SerializationException in posting new Records via Dynamodb Proxy Service in API -

asp.net - Problems sending emails from forum -