Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7308913
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T23:38:17+00:00 2026-05-28T23:38:17+00:00

Does anyone know of a Git library for C# that allows client code to

  • 0

Does anyone know of a Git library for C# that allows client code to add & modify repository files in memory? I have a bare repository that I would like to make additions and modifications to pragmatically. Because it is a bare repository I do not want to write files to the file system. Does something like this exists?

Thanks!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T23:38:18+00:00Added an answer on May 28, 2026 at 11:38 pm

    GitSharp exposes a Create() overload on its Blob type which allows a direct write to the Git Object database without the need for an intermediate file in a Working Directory.

    The unit test below (slightly patched from BlobTests.cs) demonstrates such feature:

    [Test]
    public void WriteBlob()
    {
        using (var repo = GetTrashRepository())
        {
            blob = Blob.Create(repo, "and this is the data in me\r\n\r\n");
            Assert.AreEqual("95ea6a6859af6791464bd8b6de76ad5a6f9fad81", blob.Hash);
    
            var same_blob = new Blob(repo, blob.Hash);
            Assert.AreEqual(Encoding.UTF8.GetBytes("and this is the data in me\r\n\r\n"), same_blob.RawData);
        }
    }
    

    EDIT:

    You might also be willing to take a look at NGit. It’s an automated port of JGit to .Net. Contrarily to GitSharp, it is still maintained.

    The ObjectInserter (see here) looks like something promising.

    Note: If you’re willing to use Git as an object database, by directly writing objects without the Commit dance, make sure to create a reference (in .git/refs) to prevent them from being pruned upon a git gc launch.

    Note 2: Git objects are read only, so you won’t be able to “modify” a Blob. However, if you created a reference pointing at it, you can create a new “updated” Blob, and change the target of the reference to point at the new “version”.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Does anyone know of a Git repository browser that I can host on my
Does anyone know of any SCM(s) (e.g. svn, git, etc) that would allow me
Does anyone know how one can restrict push to some git repository branch based
Does anyone know what are the Git limits for number of files and size
I'm trying to find a Git Commit Monitor for Windows. Does anyone know whether
Does anyone know of a good Command Prompt replacement? I've tried bash/Cygwin, but that
Does anyone know of any existing packages or libraries that can be used to
Does anyone know a good Java lib that will hook into SVN so I
Does anyone know how I can, in platform-independent C++ code prevent an object from
Does anyone know of a way to get numerous read-only git repositories based off

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.