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.
At the top of your repository on GitHub.com's Quick Setup page, click to copy the remote repository URL. In the Command prompt, add the URL for the remote repository where your local repository will be pushed. Push the changes in your local repository to GitHub.com.
You need to use git pull and resolve the difference between your local changes and the remote changes before you can git push . There is still a commit in the remote branch initializing the repo that may not be in your local version.
Sometimes, Git can't make your change to a remote repository without losing commits. When this happens, your push is refused. If another person has pushed to the same branch as you, Git won't be able to push your changes: $ git push origin main > To https://github.com/USERNAME/REPOSITORY.git > !
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
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With