Coder Social home page Coder Social logo

sourcegraph-git-mirror-example's Introduction

WIP

Sourcegraph with a git mirror

This project is an example of how to set up Sourcegraph with a git mirror between it and your code host.

Overview

This project uses RalfJung/git-mirror as the mirroring system. It uses gitolite as the mirror. Docker compose is used to run Sourcegraph and Gitolite. Once it's up and running, you'll be able to add your code host as an external service to Sourcegraph. We'll cover the configuration needed to clone through the mirror rather than the code host.

Setup

To start, run the project with the following command:

SSH_KEY="$(cat ~/.ssh/id_rsa.pub)" SSH_KEY_NAME="$(whoami)" make run

Gitolite setup

Once gitolite is running, we'll need to give Sourcegraph permission to access it.

First, we need to get a public ssh key for Sourcegraph. Start by accessing the Sourcegraph Server:

docker exec -it sourcegraph /bin/bash

Next, navigate to the root user's ssh directory and create a key.

cd ~/.ssh
ssh-keygen # ... follow prompts to create the key

# Close the connection
exit

Once the key is created, copy that to your local machine.

docker cp sourcegraph:/root/.ssh/id_rsa.pub /tmp/id_rsa.pub

Next, we'll clone the gitolite-admin repository. To do this, we first must tell git clone what port gitolite is listening on. In your ~/.ssh/config, add the following entry:

Host localhost
  User git
  Port 2222

Now, clone the repository:

git clone git@localhost:gitolite-admin
cd gitolite-admin

Once inside the admin repository, all we need to do is add the public key we created to the keydir and push this change back to the origin.

cp /tmp/id_rsa.pub ./keydir
git add .
git commit -m "add sourcegraph public key"
git push origin

sourcegraph-git-mirror-example's People

Contributors

ijsnow avatar

Watchers

 avatar  avatar  avatar

Forkers

isabella232

sourcegraph-git-mirror-example's Issues

Dependency Dashboard

This issue contains a list of Renovate updates and their statuses.

Open

These updates have all been created already. Click a checkbox below to force a retry/rebase of any.

  • Pin Docker digests (alpine, sourcegraph/server)
  • Update alpine Docker tag to v3.12
  • Update sourcegraph/server Docker tag to v3.19.1
  • Check this option to rebase all the above open PRs at once

  • Check this box to trigger a request for Renovate to run again on this repository

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.