5

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:

  • 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.

7
  • You're trying to push changes from the original repository to a clone on another machine? Does pulling from the original repo work when working on the cloned repo?
    – ojrask
    Commented Jul 7, 2014 at 8:41
  • I try to push changes from the cloned repo. I just tried to pull from the cloned repo and it works. But then if I add code, commit, and Push from the cloned, I have the same error when trying to push... So I can pull, but I can't push.
    – bobby4078
    Commented Jul 7, 2014 at 8:54
  • @bobby4078 could you try from the command line, after installed a Git For windows? (msysgit.github.io)
    – VonC
    Commented Jul 7, 2014 at 9:00
  • I got this:$ git push fatal: '\192.168.0.1\GitTest\Test7' does not appear to be a git repository Warning: Your console font probably doesn't support Unicode. If you experience strange characters in the output, consider switching to a TrueType font such as Lucida Console! fatal: Could not read from remote repository. Please make sure you have the correct access rights and the repository exists.
    – bobby4078
    Commented Jul 7, 2014 at 9:10
  • Hi there. How to you clone? using https? if so the repo might have read only permissions
    – CodeWizard
    Commented Jul 7, 2014 at 10:04

2 Answers 2

7

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.

3
  • 1
    Although you are correct, this doesn't really answer his question.
    – Alex Wolf
    Commented Jul 7, 2014 at 11:06
  • 1
    Actually this answer my question, I've used git --bare init and it is now working, I can push in visual studio! Thanks.
    – bobby4078
    Commented Jul 7, 2014 at 12:13
  • Did you update the remote in your development repository to reference the new bare repository?
    – ojrask
    Commented Jun 10, 2015 at 11:21
2

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

git repo config file content

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.