简体   繁体   中英

How to change the GIT URL to which Visual Studio is trying to push?

The repo to which I need to push is this:

https://myvault.visualstudio.com/foo/_versionControl?path=bar%2Fcxmlhub

But for some reason, VS is trying to push here:

https://myvault.visualstudio.com/foo/_versionControl?path=bar%2Fcxmlhub/info/refs&service=git-receive-pack

I don't know (and can't figure out) where the extra /info/refs&service=git-receive-pack is coming from.

When I do git remote -v I get back the correct URL for both fetch and push . Also, I am already logged in to the repo on a browser on the same machine.

This is the error I am seeing:

Error encountered while pushing branch to the remote repository: Git failed with a fatal error. Unable to update url base from redirection

I've looked at these two threads:

git push gives fatal: unable to update url base from redirection:

and

fatal: unable to update url base from redirection

But they only tell me what I already know: I'm trying to push to the wrong URL. What I don't know is how to fix this!

Your remote URL is misconfigured. Git doesn't allow repository URLs to contain query strings.

The reason you're seeing the extra /info/refs&service=git-receive-pack is because that's the portion of the URL that Git adds onto the base remote URL you give it in order to discover references. If you're trying to push, Git needs to determine what the remote side has, and reading references is the first step in that process.

Your URL should likely be https://myvault.visualstudio.com/foo/_versionControl instead, and you can modify it by using git remote set-url origin https://myvault.visualstudio.com/foo/_versionControl (assuming your remote name is origin ). If that's not correct for your case, open the web page up in a browser and find the clone URL in the web interface, and then use that instead.

If you're trying to push to a subdirectory of the remote repository, know that that isn't possible. Git doesn't allow pushing into only a subdirectory of repositories.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM