Vinzent03 / obsidian-git

Integrate Git version control with automatic backup and other advanced features in Obsidian.md
MIT License
6.67k stars 281 forks source link

[Bug]: Cant create new remote branch by pushing local branch #726

Closed AlexW0lf1 closed 4 months ago

AlexW0lf1 commented 4 months ago

Describe the bug

Running Git: Push -> choose remote origin -> choose branch I see existing branches in format: origin/new origin/main

I'm working in local branch "another_branch" My intention is to create new branch on remote origin with the same name

Tried to type "another_branch", "origin/another_branch", "origin another_branch", "origin@another_branch" All failed to push 1 2

It says "Select or create the new branch by typing its name and selecting it", so there should be a possibility to create new remote branch while pushing. I just cant figure out the way I should specify it.

Relevant errors (if available) from notifications or console (CTRL+SHIFT+I)

Uncaught (in promise) Error: Pushing to https://xxx/temporary.git
error: src refspec another_branch does not match any
error: failed to push some refs to 'https://xxx/temporary.git'

    at Object.action (plugin:obsidian-git:29441:25)
    at PluginStore.exec (plugin:obsidian-git:29466:25)
    at eval (plugin:obsidian-git:26971:43)
    at new Promise (<anonymous>)
    at GitExecutorChain.handleTaskData (plugin:obsidian-git:26969:16)
    at GitExecutorChain.eval (plugin:obsidian-git:26953:44)
    at Generator.next (<anonymous>)
    at fulfilled (plugin:obsidian-git:25798:24)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)

Steps to reproduce

1.Clone existing repository via git

  1. Open folder as Obsidian vault
  2. Push changes to new branch

Expected Behavior

Git: Push -> Choose "origin" -> enter name for a new branch

Addition context

No response

Operating system

Windows

Installation Method

None

Plugin version

2.24.1

AlexW0lf1 commented 4 months ago

Pushing from main to remote branch main works correctly. I think problem is that I cant set upstream branch for the new branch, because it doesnt exist on remote yet

AlexW0lf1 commented 4 months ago

It was my mistake, I used different names for local and remote branches. Plugin works as intended