Skip to content
GitLab
    • GitLab: the DevOps platform
    • Explore GitLab
    • Install GitLab
    • How GitLab compares
    • Get started
    • GitLab docs
    • GitLab Learn
  • Pricing
  • Talk to an expert
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
    • Switch to GitLab Next
    Projects Groups Topics Snippets
  • Register
  • Sign in
  • TortoiseGit TortoiseGit
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributor statistics
    • Graph
    • Compare revisions
    • Locked files
  • Issues 380
    • Issues 380
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 16
    • Merge requests 16
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
    • Test cases
  • Deployments
    • Deployments
    • Releases
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Code review
    • Insights
    • Issue
    • Repository
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • TortoiseGitTortoiseGit
  • TortoiseGitTortoiseGit
  • Issues
  • #3200
Closed
Open
Issue created Apr 16, 2018 by zwanderer@zwanderer

Problem when adding files to a worktree which is based on a bare repo

What steps will reproduce the problem?

  1. Run the following commands on a git shell to create a bare repo and related worktree:
mkdir tmp
cd tmp
git init --bare base.git

# This is just to create an initial commit, work1 is not related to the bug at all
git clone base.git/ work1
cd work1
git commit --allow-empty -m .
git push
cd ..

# Create a worktree on work2 based on base.git
cd base.git
git worktree add ../work2 master

Those commands will create a worktree at folder work2 that shares the same gitdir with base.git. This feature allows you to check out multiple branches from the same git folder, and all git commands issued on work2 will use base.git as base.

Now, TortoiseGit will recognize work2 as a worktree right away and most commands will work on it.

  1. On Explorer create a new file, right-click and select TortoiseGit > Add.

What is the expected output? What do you see instead?

Tortoise were supposed to add the file to git without errors, instead, it shows Error: libgit2 returned: cannot create blob from file. This operation is not allowed against bare repositories.

What version of TortoiseGit and Git are you using? On what operating system?

2.6.0.0 @ Windows 10

Please provide any additional information below.

I have to work on multiple branches simultaneously, so I created individual folders checking out from same remote. Problem is that this is eating my disk space. So I learned about git worktree and I'm experimenting with it. Basically I created a bare repo, added my remote and fetched its branches and then created several worktrees for the branches I need to work on. So far, most of TortoiseGit works fine, except for adding new files.

If I open a git bash and manually add the files with git add, it works fine and TortoiseGit recognize it as added files on Diff window.

To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information
Assignee
Assign to
Time tracking