Change:
} export async function ensurePublished(repository: Repository, file: vscode.Uri) { <ins> await repository.status(); </ins> if ((repository.state.HEAD?.type === RefType.Head || repository.state.HEAD?.type === RefType.Tag) // If HEAD is not published, make sure it is && !repository?.state.HEAD?.upstream

Discussion:
ADD ISSUE DESCRIPTION HERE Version: 1.80.0 Commit: User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X ) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/114.0.0.0 Safari/537.36 Embedder: <!-- generated by web issue reporter --I got a link to a file through the local vscode ! Reproduction steps: the local vscode to open any project, -click the file, select Share, and select it into browser to open the vscode is loaded, the file path carried by the url will be lost and cannot be recognized. same problem on !
This problem is more common when sharing a file with others. Or is there any other good way
What is the result of for you? I'm guessing you have two remotes, we're probably picking the wrong one when constructing the link
hi I do have two remotes, but in fact, the link I copied carries the name of the source project group. just like ! And here is my remotes !
Thanks for confirming!
I cannot repro the behavior you describe. This is what I tried: two remotes, is and is a feature branch that is published to link from the editor gutter context menu link that is copied is for the joyceerhl remote This is the relevant code which picks the remote that your branch was published to: Can you please share your setup steps if they are different from the above steps? Thanks!
Sorry, my previous description may not be clear enough. Is our difference due to the default remote branch? ! My previous operation was to clone the source of Microsoft first: clone git remote add
Maybe here use and only the first remote was matched. So, in my case, the copied link is the remote of Microsoft.
In the linked code AFAICT we would still loop over all the remotes, favoring a perfect match for the branch's upstream and falling back to one of the remotes if any are available. We don't match on just the first remote because the predicate we pass to always returns . I tried matching your setup and copying links still works as expected for me: <img width="962" alt="image" src=""Does this happen for you on all branches or just the branch? Can I double check that you are using the context menu command from the editor gutter (right clicking on the editor line number)?

It makes me a little confused. For me, the same is true for other branches, it will find Microsoft's remote instead of my own remote. ! Before pushing the new branch, this is the effect. After pushing the new branch to my remote, the link copied from the right-click menu is also Microsoft's remote. !
hi I'm sorry, I found that the difference between me and you may be caused by my failure to update the latest version of vscode... I updated the latest version after 1.80.1 (Universal) , Now the interaction becomes, after right-clicking the file or code and selecting , a confirmation box fallback will appear, but a new problem has arisen. I have manually pushed the code to the remote, but the confirmation box still appears (at this time one of the remote branches already exists) ! ! Looks like vscode doesn't know that I 've just pushed the branch to one of the remotes But anyway after I select , after clicking on a remote in the quickPick List, the copied link is already correct.
Thanks for all the info, I have a PR out to fix this issue If you can, please try out the fix in tomorrow's Insiders build:
Does the steps in description are up to date to verify or has any other specific steps?
a desktop git repo open with two remotes the terminal, create and push a branch to one of the remotes a link from the editor gutter the link is valid