Using GitSharp to PUSH changes

How can GitSharp (Git for .NET and Mono) be used to PUSH changes changes to a remote server over SSH?

  • Find the latest commit that had a particular word/line in GIT
  • What is a good workflow for Continuous Deployment to a VPS using Travis CI and Capistrano?
  • Is there a way to get a `git diff`, but only include commits from a specified committer?
  • How do I get the Git log for a specific branch only?
  • How do I determine which changes in one branch are missing from another?
  • How do I update submodule?
  • git flow release finish -m gives different behavior in cmd and Git Bash
  • git merge ignores deleted files, existing on merged branch (renamed files)
  • Git fake squashing
  • jGit - how to add all files to staging area
  • Showing commits made directly to a branch, ignoring merges in Git
  • code coverage of new lines between 2 commits in ruby
  • 2 Solutions collect form web for “Using GitSharp to PUSH changes”

    In theory, yes, the latest GitSharp 0.3 release (June 2010) includes:

    bug fixes in the transport code (pushing / fetching via http or ssh)

    The GitSharp README.txt does have:

    Object transport

    • Fetch via ssh, git, http and bundles.
    • Push via ssh, git. Git# does not yet deltify
      the pushed packs so they may be a lot larger than C Git packs.

    You will find an example of such a push (over ssh) in this thread:

    Repository repository = new Repository(@"\path\to\my_repos");
    Commit commited = repository.Commit("Testing fromGitC#", new Author("Author", ""));
    if(commited.IsValid) {
        PushCommand pushCommand = new PushCommand {
            RefSpecs = new List<RefSpec> {
               new RefSpec("HEAD", "refs/for/master")
            Force = true,
            Repository = repository

    GitSharp is based upon a manual port of JGit from Java to C#. There is another project does this semi-automatically (with the purpose of being added to MonoDevelop)


    NGit is a port of JGit [1] to C#. This
    port is generated semi-automatically
    using Sharpen [2], a Java-to-C#
    conversion utility.

    NGit provides all functionality
    implemented by JGit, including all
    repository manipulation primitives and
    transport protocols. SSH support is
    provided by a port of jsch [3],
    included in the project.

    The project is composed by 4
    – NGit: The git library.
    – NGit.Test: Unit tests for NGit
    – NSch: The port of jsch.
    – Sharpen: Some support classes required by the above libraries.

    Git Baby is a git and github fan, let's start git clone.