Hosting your own code lets you share your code with URLs you control on your own domain.
- POSSE copy: https://github.com/cweiske, pushed onto github via a dedicated user: https://github.com/cweiske-mirror?tab=activity
- 1 Why
- 2 IndieWeb Examples
- 3 Software
- 4 Code Snippet
- 5 Source Code Embedding
- 6 Brainstorming
- 7 Host code docs versions
- 8 See Also
On indieweb server:
$ git init --bare project.git $ cd project.git $ git remote add github email@example.com:cweiske/project.git $ git config remote.github.mirror true
On Github, add the mirror user as collaborator for the project. Now test it:
$ cd /path/to/project.git $ git push github
If that works, the post-receive hook can be setup:
$ printf '#!/bin/sh\ngit push --quiet github\n' > hooks/post-receive $ chmod +x hooks/post-receive
This force-pushes the code got github, which means any changes on github that are not on my server get overwritten. Thus cannot use the merge button on github, but have to merge manually.
Tantek Çelik manually hosts the latest live version of CASSIS at: http://tantek.com/cassis.js (without revision control) and manually POSSEs it to https://github.com/tantek/cassis/blob/master/cassis.js (with revision history) since YYYY-MM-DD.
- Some of these projects are shared with a few other people who are able to log in and contribute.
- All Aaron's public code is on GitHub, because it makes it easier to share and get contributions from others.
Dmitri Shuralyov hosts Go packages created after 2017-09-13 on his personal website. His website is a custom Go package host, written in Go and fully open-source, implementing features such as git repository serving, issue tracking, notifications, history viewing, etc. As of 2021-12-27, it also supports performing code review on changes before submitting them.
Software you can use to host your own Git repository:
- GitWeb - https://git.wiki.kernel.org/index.php/Gitweb
- GitLab - https://www.gitlab.com/
- GitPHP - http://www.gitphp.org/
- Gogs - https://gogs.io/
- Gitea is a fork of Gogs - https://gitea.io/
Similar to source code hosting, but simpler and often used for examples rather than actual running code, code snippet hosting is a way of sharing bits of code from your site instead of an entire file.
Source Code Embedding
Differences between pastebin views and embeds
It can be necessary to have different markup for embedded source code and the source code display in the pastebin tool.
Use case: Work with and modify the paste. Single files have edit and "raw" view buttons, maybe more. File names are important and are shown before the code itself.
Use case: Show a bit of colorful source code, but don't get in the way. No edit buttons. File names are unimportant, so show them after the code.
Cweiske.de 13:00, 20 March 2014 (PDT)
Instead of the usual "fork me on github" buttons, projects should use a more general "fork me" button.
It should fork the code onto the user's preferred git server instead of a silo. The button could either work like subtome, showing a list of services that support remote forking, or simply use a custom protocol like "web+fork://" that web sites can register itself as HTML5 protocol handler.
The URL syntax could be like the feed uri syntax:
The linked URL could be the homepage of the project, with embedded rel-vcs links that provide the git:// or http:// URLs to the git repository. Or it could be the git repository URL itself. phorkie supports remote forking via rel-vcs since version 0.3.1. See the blog post for a description of the process.
Host code docs versions
Brainstorming: host code, with documentation, ideas behind it, versions over time: https://twitter.com/AndreJaenisch/status/1331900348752138240
- "Good to know!
Look, I like to host code I write on my site (eventually).
I would like to document the process of making and my ideas behind it.
The only way I can do that in CodePen is through comments (or a section in the HTML).
Then, you cannot see the progress over time." @AndreJaenisch November 26, 2020