Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
B
blog
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
nimrod
blog
Commits
a8f01305
Commit
a8f01305
authored
8 years ago
by
nimrod
Browse files
Options
Downloads
Patches
Plain Diff
- Added post about ad-hoc serving of git repos.
parent
30ca6a50
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
content/git_serve.rst
+54
-0
54 additions, 0 deletions
content/git_serve.rst
with
54 additions
and
0 deletions
content/git_serve.rst
0 → 100644
+
54
−
0
View file @
a8f01305
Ad-hoc serving of git repositories
##################################
:date: 2016-08-16
:summary: Ad-hoc serving of git repositories
On some occasion you want to serve your git repo from your local copy (perhaps
your git repository is quite large and your internet connection is slow or your
build process would benefit from pulling from an intermediary without
authentication). Here are 2 ways to serve your git repository without any
configuration or software installation. Both ways serve a single repository
without authentication or encryption but readonly (no push).
Using the git protocol
----------------------
The git executable is itself a git server using the native git protocol. Inside
the root of the repository run the following command
.. code:: shell
git daemon --reuseaddr --verbose --base-path=. --export-all ./.git
And on the client you can clone by running
.. code:: shell
git clone git://servername/ reponame
Using the http protocol
-----------------------
This way serves the repo over HTTP using Python 2's SimpleHTTPServer. Run the
following in the rot of the git repo
.. code:: shell
git update-server-info
cd .git
python -m SimpleHTTPServer
And on the client clone by running
.. code:: shell
git clone http://servername:8000/ reponame
Final words
-----------
I've added both ways as git aliases in my `rcfiles repo
<https://www.shore.co.il/cgit/rcfiles/tree/.gitconfig>`_.
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment