added contribution instructions

s00ner 2022-02-22 15:22:46 -05:00 committed by Gitea
parent 4ae24abe7b
commit 04bc2a6ed0
2 changed files with 45 additions and 1 deletions

View File

@ -6,3 +6,8 @@
- [Create an Account](getting_started/create_account.md) - [Create an Account](getting_started/create_account.md)
- [Set Up a Hacking Machine](getting_started/machine_setup.md) - [Set Up a Hacking Machine](getting_started/machine_setup.md)
- [Start Hacking](getting_started/start_hacking.md) - [Start Hacking](getting_started/start_hacking.md)
----------
# Contributing
- [How to Contribute](contribute/how_to.md)

39
contribute/how_to.md Normal file
View File

@ -0,0 +1,39 @@
# How to Contribute
Have something to add to this site? Here's how.
## Overview
The source code for this site is hosted on s00ner's Gitea server at <https://git.doublehack.me/s00ner/Baltimore-hackthebox-knowledgebase>. It's a static site built with [mdbook](https://rust-lang.github.io/mdBook/index.html) and hosted by s00ner. If you'd like to contribute you should be familiar with [Git](https://training.github.com/downloads/github-git-cheat-sheet/) and [Markdown](https://rust-lang.github.io/mdBook/format/markdown.html) which are both relatively east to learn. You do not need to worry about html or javascript since that is created by mdbook. If you browse the source files in the repository alongside the website it will become apparent how the markdown files are translated into html.
## Details
This is how you can get set up to start making changes and adding new pages.
### Request a Giteea Account
The [Gitea sever](https://git.doublehack.me) has new user registration turned off to prevent random people on the internet from creating accounts. Send s00ner a message on Discord with your desired username and your email address and I'll create an account for you.
#### Optional - SSH Key Setup
If you'd like to use SSH to access your repository you can upload your public key to the Gitea server. Navigate to <https://git.doublehack.me/user/settings/keys> and add your public key to your profile. You can use `ssh-keygen` to create a new keypair. Please remember to keep your private key private and protected.
### Fork the Repository
Head over to <https://git.doublehack.me/s00ner/Baltimore-hackthebox-knowledgebase> and click the "Fork" button near the top-right of the page. This will create a copy of the repository under your account where you can make changes.
### Making Changes
Let's create some content!
#### The Easy Way
You can directly edit and create files using the Gitea web UI. Navigate to the file you'd like to edit and click the pencil icon. This will open the editor where you can modify the markdown files. Once you've finished, scroll down to the "Commit Changes" section at the bottom of the page. Add a commit message that describes what you did and then click "Commit Changes". If you're creating a new page just click the "New File" button in the directory you want your page to live and follow the same process as editing a page.
#### The Slightly Less Easy Way (But it's Still Pretty Easy)
If you're already familiar with Git and text editing you can follow the typical Git workflow. Once you've created your fork, do a `git clone` to download the repository locally. Make the changes you'd like to make using your favorite text editor and use `git add [file]` to stage your changes and then `git commit -m "[Describe what you did]"` to commit them. Once you're all done do a `git push` to send your commits to the server.
### The Pull Request
You're all done creating your content and you're ready for your changes to make their way to the site. Go ahead and navigate back to the primary repository at <https://git.doublehack.me/s00ner/Baltimore-hackthebox-knowledgebase> and click on the "New Pull Request" button. For this request the left dropdown box should read "merge into: s00ner:main" and the right one should read "merge from: [your username]:main". This page will show a diff of your proposed changes. If everything looks good, click the "New Pull Request" button and give your request a title and a description, then click "Create Pull Request". That's all you have to do. Sit tight and s00ner will review the request and if everything looks good your request will be accepted and the site will update to reflect you changes. If s00ner is taking too long to review your request please message him on Discord.
## Helpful Tips
Some general stuff to help you out.
- You might have noticed a file `Jenkinsfile` in the repo. Please do not modify this. Any pull requests with changes to this file will be rejected.
- If you have created a new page, make sure to update `SUMMARY.md` to link to your page so it will show up in the sidebar.
- Keep your personal fork up to date. As time passes and changes get made to the upstream repo you working fork will fall behind. You can resync it with upstream by using a Pull Request in the web UI or on the command line following [this guide](https://www.freecodecamp.org/news/how-to-sync-your-fork-with-the-original-git-repository/).