npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

git-server-windows

v1.0.8

Published

Remote Git Server for Windows

Downloads

6

Readme

git-server-windows: a git http server specifically for Windows

git-server-windows is a simple, easy to configure git server specifically designed for Windows. It works around the common SPAWN error regarding the execution of git-receive-pack. It supports authentication.

Precondition

git for Windows needs to be installed on the machine prior to running git-server-windows

Installation

 # npm install git-server-windows

Prepare the environment

git-server-windows uses two batch files in order to execute certain git commands. Those batch files need to be located in the path you're running your git server.

 # copy node_modules/git-server-windows/*.cmd .

The files are called git-receive-pack.cmd and git-upload-pack.cmd

After copying those files, your project folder should at least contain the following elements:

 index.js                // your server implementation
 node_modules
 git-receive-pack.cmd
 git-upload-pack.cmd

Initializing bare git repositories

Every git repository on your server must be initialized as a bare repository before it can be used with the server.

First create a subfolder for the repositories inside your project folder:

 # md repos
 # cd repos

Then (for each planned repository) create a subfolder inside the repos folder:

 # md myRepository
 # cd myRepository

 # git init --bare

Create the server code

For a basic server put this into your index.js:

// This is a simple example for a basic git server with no authentication

var Git = require('git-server-windows');

Git.server();

Starting the git server

 # node index.js
 Git Server listening on port 8080 ...

Test the git server with a git client

In this example, let's assume you already have a local git repository which you want to store on your newly created git server. You can do this by adding a remote to your git project which points to the server:

 # git remote add myserver http://xxx.xxx.xxx.xxx:8080/git/myRepository

and then pushing your code to this remote:

 # git push -u myserver master

Advanced configuration

The git server can be configured using a parameter object on creation:

{
   port: 8080,
   baseURL: '/git',
   repoDir: 'repos',
   defaultUsers: [],
   repositories: OBJECT
}

By default the server will be started on port 8080, using /git as the base URL, repos as the subfolder name of your repositories and an empty user list. All of the subfolders of repos will be used as repositories.

baseURL

The baseURL configuration parameter is used to determine the base URL part of your git URL.

Example: If you want to access your server as http://xxx.xxx.xxx.xxx:8080/mygit/REPOSITORYNAME you'd have to set

baseURL: '/mygit'

repoDir

The repoDir configuration parameter defines the name of the project subfolder that contains the git repositories.

defaultUsers

defaultUsers is an array of Git.User objects. If you specify such a list, the repository users will have to authenticate before they can push to the repository:

var myUser = new Git.User({
   username: 'myusername',
   password: 'mypassword'
});

Git.server({ defaultUsers: [myUser] });

repositories

By default, every subfolder of the folder specified by repoDir will be used as a repository with the users specified by defaultUsers.

If you want to change the list of users that can authenticate themselves against a repository on a per-repository basis, you can use the repositories configuration parameter:

Git.server({
   defaultUsers: [myUser],
   repositories: {
      'myOtherRepository' : []
   }
});

In this example, users need to authenticate to every repository but myOtherRepository

var myUser = new Git.User({
   username: 'myusername',
   password: 'mypassword'
});

var anotherUser = new Git.User({
   username: 'myotherusername',
   password: 'myotherpassword'
});

Git.server({
   defaultUsers: [myUser],
   repositories: {
      'myOtherRepository' : [anotherUser]
   }
});

In this example, the user myUser can authenticate against every repository but myOtherRepository which requires anotherUser to authenticate.