Launch Git from Visual Studio


Tools -> External Tools -> Add New

Name: Git Bash

Command: c:\Program Files (x86)\git\bin\sh.exe

Args: –login –i

Initial Dit: $(SolutionDir)

Also Set a Shortcut for it if u want

Also Try:

Going a step beyond: use visual studio output window for git bash : DID NOT FIND ANY WAY TO DO THIS..

What got me excited was the option of “Reditect to o/p window” in the External Tools config above, but it doesn’t work…


Bare vs non-bare GIT repository

I was using non-bare repo on local shared drive as the remote for my team, but when someone tries to push, it gives ERROR:

Pushing to //miapgkhematarwd/dropbox/LND1

remote: error: refusing to update checked out branch: refs/heads/develop[K

remote: error: By default, updating the current branch in a non-bare repository[K

remote: error: is denied, because it will make the index and work tree inconsistent[K

remote: error: with what you pushed, and will require ‘git reset –hard’ to match[K

remote: error: the work tree to HEAD.[K

remote: error: [K

remote: error: You can set ‘receive.denyCurrentBranch’ configuration variable to[K

remote: error: ‘ignore’ or ‘warn’ in the remote repository to allow pushing into[K

remote: error: its current branch; however, this is not recommended unless you[K

remote: error: arranged to update its work tree to match what you pushed in some[K

remote: error: other way.[K

remote: error: [K

remote: error: To squelch this message and still keep the default behaviour, set[K

remote: error: ‘receive.denyCurrentBranch’ configuration variable to ‘refuse’.[K

To //miapgkhematarwd/dropbox/LND1

! [remote rejected] develop -> develop (branch is currently checked out)

error: failed to push some refs to ‘//miapgkhematarwd/dropbox/LND1’

GitExtensions: personal repository vs central repository


Create new repository

When you do not want to work on an existing project, you can create your own repository using this option.

Select a directory where the repository is to be created. You can choose to create a Personal repository or a Central repository.

A personal repository looks the same as a normal working directory but has a directory named .git at the root level containing the version history. This is the most common repository.

Central repositories only contain the version history. Because a central repository has no working directory you cannot checkout a revision in a central repository. It is also impossible to merge or pull changes in a central repository. This repository type can be used as a public repository where developers can push changes to or pull changes from.


use shared folder as remote git repository

I had such issues with this, firstly on deciding wheter to use Bare repo or one with work area, and the pros and cons of that….eventually i tried both ways and realised that Bare was the best option.

Secondly i just wasn’t able to understand that when i git init to create a new repo, why can i not create develop branch on it ?

Finally i realised that i had to check in some code in the out of the box master branch before i was allowed to create another branch.

This was with the workspace one.


Finally when i went with Bare, i cloned the master and checked in code into it and then created remote develop from the client side, as git branch etc. cannot be run on bare repos.

Working with Bare GIT Repos

Working with Bare GIT Repos

  1. Bare Repos are used for managing the project centrally.
  2. They do not contain a work area
  3. Conventionally called .git



  1. git –bare init tdp.git
  2. That’s about all that u can do from here


  1. git clone //miapgkhematarwd/dropbox/tdp.git


The only issue with above client side steps is that they work only if the remote repo has code in the master branch. Without that it doesn’t work right.

The way I did was to clone the repo using VS 2013 (I feel that using Git Extensions should also work).

Then added code to master and pushed to remote

Then only did it let me create local develop branch and then I commited code to it. BUT now how to push?

For that I did git push origin develop, so that it created develop on remote on its own

But is still doesn’t make the local dev track remote dev, so git pull will fail.

For that do: git branch –set-upstream-to=origin/develop

git remote -v show origin is a good command to see all this status of branches and mappings.


If only I can find the git commands that visual studio 2013 team explorer runs, I would know what I am missing


git remote add origin <url-of-bare-repo>

git push –all origin

See for more details “GIT: How do I update my bare repo?“.

  • you can use a different name than ‘origin’ for the bare repo remote reference.
  • this won’t push your tags, you need a separate git push –tags origin for that.


GOOD: Adding existing code to a bare remote git repository



how to find if local branch is tracking remote or not


USE: git remote show origin

HEAD branch: master

Remote branches:

develop tracked

master  tracked

Local branches configured for ‘git pull’:

develop merges with remote develop

master  merges with remote master

Local refs configured for ‘git push’:

develop pushes to develop (up to date)

master  pushes to master  (up to date)