在过去的几天里,我一直在尝试使用GitLens扩展将一个分支从VS Code推送到一个私有repo,结果却失败了,并显示了以下神秘的消息:
[2022-12-02 21:00:41.637]
Failed to execute git {
"exitCode": 128,
"gitErrorCode": "RemoteConnectionError",
"gitCommand": "push",
"stdout": "",
"stderr": "fatal: 'my-branch' does not appear to be a git repository\nfatal: Could not read from remote repository.\n\nPlease make sure you have the correct access rights\nand the repository exists.\n"
}
我尝试重新安装扩展,并在用户和工作区设置中设置了(私有)GitHub Enterprise Server URI。我还将github-enterprise.uri设置的值设置为“my.corporate.github.com/Organization“(当然是真实的值)。
记录在案:
- VS代码版本:版本:1.73.1(通用)(Mac)
- GitLens版本:版本13.1.1
所以很明显GitLens找不到远程存储库的名称,我该如何唤起它的记忆呢?
为了记录在案,一些常见命令的输出(编辑以避免敏感信息):
$ git status
On branch my-branch
Changes not staged for commit:
(use "git add <file>..." to update what will be committed)
(use "git restore <file>..." to discard changes in working directory)
modified: api/someFile.sh
modified: docker/docker-compose.yml
modified: docker/superfluous-edit.yml
Untracked files:
(use "git add <file>..." to include in what will be committed)
docker/all-containers.sh
no changes added to commit (use "git add" and/or "git commit -a")
$ git branch -avv | cat
add-test-data 23411432 [origin/add-test-data] Refine name and add test data
arm-docker-changes a7c88c7a [origin/arm-docker-changes: behind 2] Remove stray fwd'ing of port
master b0b66b0b [origin/master: behind 3] Merge pull request #1653 from another_branch
* my-branch df8a65e7 Merge to local
... more branch/commit descriptions, nothing else ... ```
2条答案
按热度按时间vof42yt11#
正如我所怀疑的,这是一个GitLens的问题。我通过升级到该扩展的预发布版本(v2022.12.904)来解决它。
不幸的是,我没有更多的信息来解释到底是什么地方出了问题。但是,我确实在GitLens的回购协议上发布了一个问题。
l7mqbcuq2#
从VSCode内的终端,将远程重置为远程系统信息库的URL(HTTPS或SSH):
然后检查
git branch -avv
的结果,检查您的my-branch
是否确实列出。