question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

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:open
  • Created 3 years ago
  • Comments:10 (8 by maintainers)

github_iconTop GitHub Comments

2reactions
kzhui125commented, Jun 24, 2020

@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.

1reaction
plainermancommented, Jan 11, 2021

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.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found