git sync issue on an empty repo
See original GitHub issue- VSCode Version: 1.46.1
- OS Version: macOS 10.15.5
Steps to Reproduce:
# create empty repo test1
git clone https://.../test1.git test1_01
git clone https://.../test1.git test1_02
cd test1_01
code ./
# add 1.txt -> commit -> sync
cd ../test1_02
code ./
# click sync: I expect changes will be synced
Issue Analytics
- State:
- Created 3 years ago
- Comments:10 (8 by maintainers)
Top Results From Across the Web
why it is showing a empty repository? - Stack Overflow
1 Answer 1 · uploading a file is not enough · you need to type a short, meaningful commit message that describes the...
Read more >Error on syncrhonising to git, reports an issue seemingly from ...
Hi, We're attempting to synchronise one of our repositories with git (in this case, an empty repo in gitlab). We've already successfully ...
Read more >Syncing with GitHub | Introduction to Git and GitHub
Create an empty GitHub repository. Log into your GitHub account and create a new repository by clicking the + icon in the upper-right...
Read more >Set up a Git repository | PyCharm Documentation - JetBrains
You can choose Always Add to synchronize project settings with other repository users who work with PyCharm. Notification prompting to select ...
Read more >Troubleshooting GitHub Sync and Integration | Apiary Help
GitHub repository cannot be empty when connecting to Apiary. You must initialize repository with at least 1 file before connecting to Apiary. I...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@joaomoreno here is the recording
2020-06-24.gif.zip
I expect changes will be synced if I click the sync button, or a message.
But there is no response now.
I was finally able to identify and resolve the problem.
The core issue why the button is showing and sync does not work, is that to fetch the upstream (remote and remote branch name)
git rev-parse
is used. Compare here:https://github.com/microsoft/vscode/blob/3f3e35bf17ecf423dca5dc613e7c32474a8f9f16/extensions/git/src/git.ts#L2000-L2001
Executing this command on an empty repository throws an error, as described in this stackoverflow post.
In theory, this could be resolved somehow in the sync method itself https://github.com/microsoft/vscode/blob/3f3e35bf17ecf423dca5dc613e7c32474a8f9f16/extensions/git/src/commands.ts#L2244
by handling this edge case separately. IMO, although possible, this becomes very messy and since it does not solve the underlying problem we should not do this.
See my PR (#114163) for more information.