Can't push a git repo on a local server

I have a local Git server set up on my network, but I’m having issues committing my project code to it.

Here are the steps I’ve tried so far:

  • copy/mv directory to another directory in git
  • Automatically copy pushed files from one GitHub repository to another
  • Multiple git checkouts from a single repo with hardlinks?
  • how to completely replace code in a git repository
  • Git post-receive hook not working
  • Visual Studio Code Git shows all changes on drive?
    • Using visual studio 2013 a create a new project. Then while still inside the IDE I right click on my solution in the solution explorer and I add the solution to source control. For the source control type I use ‘Git’ as that’s what type my local server is. I create this project on my local server machine which is at address 192.168.0.1

    • Once everything is set up, I commit the project into my source control system and push the changes.

    • I then close the solution that I’ve just committed, and close visual studio.

    • I then move to a different machine (Where I want to work on my project) open visual studio 2013, open Team explorer and clone the project that I just created in previous steps.

    • I use the following settings to clone this new project:

      Git repo to clone : 192.168.0.1/GitTest/Test1

      Where to clone : C:/Users/Me/Desktop/GitTest/

    Once I click on the clone button, everything works as I expect, the solution is created on the new machine, the files I initially created and everything looks ok.

    The previously cloned project opens fine in visual studio and I see exactly what I expect to see in my solution explorer.

    • My next step is to add some code to the project, I do this in the usual manner of adding new items and typing in some code, then saving it.

    • Once I have some code to commit, I go back into the Team Explorer, I find my list of changes and a click on the required buttons to commit them.

    It’s at this point where things start to fail.

    In Un-Synced commits section I click on the button labeled push and I’m immediately presented with an error message stating the following:

    An error occurred. Detailed message: An error was raised by libgit2. Category = Unknown (Error). No error message has been provided by the native library.

    I have no idea what this error means or how to fix it, has anyone here come across this error before, or even a similar situation which they’ve been able to fix, if so could anyone tell me how they managed to get things working.

    Many Thanks in advance if you can.

  • How to delete commits with egit?
  • Issue with Git folder placement and Heroku deployment
  • Using GitBash packaged with Atlassian, SourceTree “Vagrant Up” doesn't work
  • SQLite database pushed to EC2 server having trouble
  • Scala IDE and classpath
  • How do I recursively remove temporary files containing ~ in git repositories
  • 2 Solutions collect form web for “Can't push a git repo on a local server”

    Pushing to non-bare repositories (repositories that contain working trees with actual file contents) is considered bad practise. Instead you should create a central bare repository to and from which you push and pull changes from each individual dev repository.

    You can create a bare Git repository using git init --bare. Then just set the bare repo as a remote for a dev repository.

    For non-bare repositories only pulling is an option. You could push -f, but be sure to verify forced changeset pushing with your fellow developers who might be working on the same repositories.

    If you want, you can also create a hosted bare repository to Github, Bitbucket and the like.

    At your git project repo, modify .git\config file content, change bare = false to bare = true.

    git repo config file content

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