I develop on Windows (yeah, I hear your jeers, linux users!), so to use Git, I use Git for Windows.
However, I use Git for Windows (portable version) so I can keep my dev environment centrally located. This is so I can reuse this environment simply by copying my PortableGit directory to a USB drive.
Using a portable set up means you can't use those handy automatic installers to your dev environment. This makes installing other scripts like node.js a little bit more difficult because you have to manually do-it-yourself. No biggie! This is what this guide is for!
https://github.com/git-for-windows/git/releases/
And follow the instructions below to actually make PortableGit save files in a portable location.
https://gist.github.com/r-a-y/da6c3b1b99aafcb3e97e311280aa9434
Now that you have PortableGit set up, you should have a folder called home/portable in the folder where you extracted PortableGit.
Download the node.js Windows binary:
https://nodejs.org/en/download/current
Extract the entire directory containing the node_modules folder and node.exe to a new home/portable/node folder. So your /home/portable/node/ directory should include /home/portable/node/node_modules/ and the /home/portable/node/ directory should include everything found in the ZIP including node.exe.
Now that you've installed node.js and npm, you still need to let msysgit know about it so you can run node and npm.
Since I use the bundled version of bash that comes with PortableGit, this section is applicable only to bash users. Windows command-line users have to add the PATH using a method similar to this - https://gist.github.com/Anachron/7006751
Create a file called .bashrc in your home/portable folder.
In it, put the following:
# function to easily add a path
# http://superuser.com/a/39995
pathadd() {
if [ -d "$1" ] && [[ ":$PATH:" != *":$1:"* ]]; then
PATH="${PATH:+"$PATH:"}$1"
fi
}
# add node directory to PATH
pathadd $HOME/node
Now, run git-bash.bat as usual and type:
npm --version
You should get the npm version number and you should be up and running!