forked from gabrielcsapo/node-git-server
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
198 lines (152 loc) Β· 10.7 KB
/
index.html
File metadata and controls
198 lines (152 loc) Β· 10.7 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Home - Documentation</title>
<script src="scripts/prettify/prettify.js"></script>
<script src="scripts/prettify/lang-css.js"></script>
<!--[if lt IE 9]>
<script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
<link type="text/css" rel="stylesheet" href="styles/prettify.css">
<link type="text/css" rel="stylesheet" href="styles/jsdoc.css">
</head>
<body>
<input type="checkbox" id="nav-trigger" class="nav-trigger" />
<label for="nav-trigger" class="navicon-button x">
<div class="navicon"></div>
</label>
<label for="nav-trigger" class="overlay"></label>
<nav>
<h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="Git.html">Git</a><ul class='methods'><li data-type='method'><a href="Git.html#.close">close</a></li><li data-type='method'><a href="Git.html#.create">create</a></li><li data-type='method'><a href="Git.html#.exists">exists</a></li><li data-type='method'><a href="Git.html#.handle">handle</a></li><li data-type='method'><a href="Git.html#.list">list</a></li><li data-type='method'><a href="Git.html#.listen">listen</a></li><li data-type='method'><a href="Git.html#.mkdir">mkdir</a></li></ul></li><li><a href="HttpDuplex.html">HttpDuplex</a><ul class='methods'><li data-type='method'><a href="HttpDuplex.html#addTrailers">addTrailers</a></li><li data-type='method'><a href="HttpDuplex.html#cork">cork</a></li><li data-type='method'><a href="HttpDuplex.html#destroy">destroy</a></li><li data-type='method'><a href="HttpDuplex.html#end">end</a></li><li data-type='method'><a href="HttpDuplex.html#getHeader">getHeader</a></li><li data-type='method'><a href="HttpDuplex.html#pause">pause</a></li><li data-type='method'><a href="HttpDuplex.html#removeHeader">removeHeader</a></li><li data-type='method'><a href="HttpDuplex.html#resume">resume</a></li><li data-type='method'><a href="HttpDuplex.html#setDefaultEncoding">setDefaultEncoding</a></li><li data-type='method'><a href="HttpDuplex.html#setEncoding">setEncoding</a></li><li data-type='method'><a href="HttpDuplex.html#setHeader">setHeader</a></li><li data-type='method'><a href="HttpDuplex.html#uncork">uncork</a></li><li data-type='method'><a href="HttpDuplex.html#write">write</a></li><li data-type='method'><a href="HttpDuplex.html#writeContinue">writeContinue</a></li><li data-type='method'><a href="HttpDuplex.html#writeHead">writeHead</a></li><li data-type='method'><a href="HttpDuplex.html#writeHeader">writeHeader</a></li></ul></li><li><a href="Service.html">Service</a><ul class='methods'><li data-type='method'><a href="Service.html#.accept">accept</a></li><li data-type='method'><a href="Service.html#.reject">reject</a></li></ul></li></ul><h3>Modules</h3><ul><li><a href="module-lib_util.html">lib/util</a><ul class='methods'><li data-type='method'><a href="module-lib_util.html#~basicAuth">basicAuth</a></li><li data-type='method'><a href="module-lib_util.html#~createAction">createAction</a></li><li data-type='method'><a href="module-lib_util.html#~infoResponse">infoResponse</a></li><li data-type='method'><a href="module-lib_util.html#~noCache">noCache</a></li><li data-type='method'><a href="module-lib_util.html#~onExit">onExit</a></li><li data-type='method'><a href="module-lib_util.html#~parseGitName">parseGitName</a></li><li data-type='method'><a href="module-lib_util.html#~serviceRespond">serviceRespond</a></li></ul></li></ul><h3>Events</h3><ul><li><a href="HttpDuplex.html#event:close">close</a></li><li><a href="HttpDuplex.html#event:data">data</a></li><li><a href="HttpDuplex.html#event:drain">drain</a></li><li><a href="HttpDuplex.html#event:end">end</a></li><li><a href="HttpDuplex.html#event:error">error</a></li><li><a href="Git.html#event:fetch">fetch</a></li><li><a href="Git.html#event:head">head</a></li><li><a href="Git.html#event:info">info</a></li><li><a href="Git.html#event:push">push</a></li><li><a href="Git.html#event:tag">tag</a></li></ul><h3>Global</h3><ul><li><a href="global.html#getType">getType</a></li></ul>
</nav>
<div id="main">
<section class="readme">
<article><h1>node-git-server</h1><blockquote>
<p>π‘ A configurable git server written in Node.js</p>
</blockquote>
<blockquote>
<blockquote>
<p>there be π² here! The API's and functionality are still be cemented, anything before a 1.0.0 release will be subject to change.</p>
</blockquote>
</blockquote>
<p><a href="https://www.npmjs.com/package/node-git-server"><img src="https://img.shields.io/npm/v/node-git-server.svg" alt="Npm Version"></a>
<a href="https://travis-ci.org/gabrielcsapo/node-git-server"><img src="https://travis-ci.org/gabrielcsapo/node-git-server.svg?branch=master" alt="Build Status"></a>
<a href="https://lcov-server.gabrielcsapo.com/coverage/github%2Ecom/gabrielcsapo/node-git-server"><img src="https://lcov-server.gabrielcsapo.com/badge/github%2Ecom/gabrielcsapo/node-git-server.svg" alt="Coverage Status"></a>
<a href="https://starbuck.gabrielcsapo.com/github/gabrielcsapo/node-git-server"><img src="https://starbuck.gabrielcsapo.com/badge/github/gabrielcsapo/node-git-server/status.svg" alt="Dependency Status"></a>
<a href="https://starbuck.gabrielcsapo.com/github/gabrielcsapo/node-git-server#info=devDependencies"><img src="https://starbuck.gabrielcsapo.com/badge/github/gabrielcsapo/node-git-server/dev-status.svg" alt="devDependency Status"></a>
<a href=""><img src="https://img.shields.io/npm/dt/node-git-server.svg" alt="npm"></a>
<a href=""><img src="https://img.shields.io/npm/dm/node-git-server.svg" alt="npm"></a></p>
<h1>Install</h1><pre class="prettyprint source"><code>npm install node-git-server</code></pre><h1>Usage</h1><h2>Simple</h2><pre class="prettyprint source lang-javascript"><code>const path = require('path');
const Server = require('node-git-server');
const repos = new Server(path.resolve(__dirname, 'tmp'), {
autoCreate: true
});
const port = process.env.PORT || 7005;
repos.on('push', (push) => {
console.log(`push ${push.repo}/${push.commit} (${push.branch})`);
push.accept();
});
repos.on('fetch', (fetch) => {
console.log(`fetch ${fetch.commit}`);
fetch.accept();
});
repos.listen(port, () => {
console.log(`node-git-server running at http://localhost:${port}`)
});</code></pre><p>then start up the node-git-server server...</p>
<pre class="prettyprint source"><code>$ node example/index.js</code></pre><p>meanwhile...</p>
<pre class="prettyprint source"><code>$ git push http://localhost:7005/beep master
Counting objects: 356, done.
Delta compression using up to 2 threads.
Compressing objects: 100% (133/133), done.
Writing objects: 100% (356/356), 46.20 KiB, done.
Total 356 (delta 210), reused 355 (delta 210)
To http://localhost:7005/beep
* [new branch] master -> master</code></pre><h2>Sending logs</h2><pre class="prettyprint source lang-javascript"><code>const path = require('path');
const Server = require('node-git-server');
const repos = new Server(path.resolve(__dirname, 'tmp'), {
autoCreate: true
});
const port = process.env.PORT || 7005;
repos.on('push', (push) => {
console.log(`push ${push.repo}/${push.commit} (${push.branch})`);
repos.list((err, results) => {
push.log(' ');
push.log('Hey!');
push.log('Checkout these other repos:');
for(const repo of results) {
push.log(`- ${repo}`);
}
push.log(' ');
});
push.accept();
});
repos.listen(port, () => {
console.log(`node-git-server running at http://localhost:${port}`)
});</code></pre><p>then start up the node-git-server server...</p>
<pre class="prettyprint source"><code>$ node example/index.js</code></pre><p>meanwhile...</p>
<pre class="prettyprint source"><code>$ git push http://localhost:7005/beep master
Counting objects: 356, done.
Delta compression using up to 2 threads.
Compressing objects: 100% (133/133), done.
Writing objects: 100% (356/356), 46.20 KiB, done.
Total 356 (delta 210), reused 355 (delta 210)
remote:
remote: Hey!
remote: Checkout these other repos:
remote: - test.git
remote:
To http://localhost:7005/test
77bb26e..22918d5 master -> master</code></pre><h3>Authentication</h3><pre class="prettyprint source lang-javascript"><code>const path = require('path');
const Server = require('node-git-server');
const repos = new Server(path.resolve(__dirname, 'tmp'), {
autoCreate: true,
authenticate: (type, repo, user, next) => {
if(type == 'push') {
user((username, password) => {
console.log(username, password);
next();
});
} else {
next();
}
}
});
const port = process.env.PORT || 7005;
repos.on('push', (push) => {
console.log(`push ${push.repo}/${push.commit} (${push.branch})`);
push.accept();
});
repos.on('fetch', (fetch) => {
console.log(`fetch ${fetch.commit}`);
fetch.accept();
});
repos.listen(port, () => {
console.log(`node-git-server running at http://localhost:${port}`)
});</code></pre><p>then start up the node-git-server server...</p>
<pre class="prettyprint source"><code>$ node example/index.js</code></pre><p>meanwhile...</p>
<pre class="prettyprint source"><code>$ git push http://localhost:7005/beep master
Counting objects: 356, done.
Delta compression using up to 2 threads.
Compressing objects: 100% (133/133), done.
Writing objects: 100% (356/356), 46.20 KiB, done.
Total 356 (delta 210), reused 355 (delta 210)
To http://localhost:7005/beep
* [new branch] master -> master</code></pre><h1>Example</h1><p>Running the following command will start up a simple http server:</p>
<pre class="prettyprint source"><code>node example/index.js</code></pre><p>If you want to try using https run the following</p>
<pre class="prettyprint source"><code>node example/index.js --https</code></pre><blockquote>
<p>When running https with self-signed certs there are two ways to override the git-clients behavior using <code>git config http.sslVerify false</code> or <code>git config --global http.sslCAInfo /path/to/cert.pem</code></p>
</blockquote>
<p>For more information please visit the <a href="http://www.gabrielcsapo.com/node-git-server/code/index.html">docs</a></p>
<h1>Philosophy</h1><p>This library is aimed to have a zero dependency footprint. If you are reading this and you see dependencies, help to remove them π.</p>
<h1>Thanks</h1><p>This is a hard fork from <a href="https://github.com/substack/pushover">pushover</a>.</p></article>
</section>
</div>
<br class="clear">
<footer>
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a> using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
</footer>
<script>prettyPrint();</script>
<script src="scripts/linenumber.js"></script>
</body>
</html>