Push documentation to GitHub
These instructions assume that you have documentation changes ready to push to GitHub.
To push your documentation changes to GitHub for the first time, you must:
- create local and remote GitHub repos
- commit all changes in the local repos
- link the local repo to the remote repo
- link the local master branch to the remote master branch
- push the staged commit to the remote repo
Create local and remote GitHub repos
Create a remote empty repo in your organisation on GitHub.
You should select the following settings:
- no readme file - no `.gitignore` - MIT license - yes to dependabot
- Create a new local documentation repo if required.
Commit all changes in the local repo
This initial commit happens on the master branch. You should use non-master branches for subsequent changes.
Go to the local repo directory in the command line.
Make the created local repo into a Git repo:
If applicable, add all files in the local repo and stage them for commit:
git add .
Commit the staged files:
git commit -m "COMMIT-MESSAGE"`
COMMIT-MESSAGEis the message describing the commit.
Link the local repo to the remote repo
Go to the remote repo in GitHub.
Select the Clone or download button.
Select either Use HTTPS or Use SSH.
Select the copy button.
In the command line, link the local repo to the remote repo:
git remote add origin REMOTE-REPO-URL
Verify the remote repo:
git remote -v
Link the local master branch to the remote master branch
In the command line, rebase the local master branch on to the remote master branch:
git pull --rebase
Tell your local repo which master branch to refer to:
git branch --set-upstream-to=origin/master
git pull --rebase
Push the staged commit to the remote repo
Push the changes in your local repo to the remote repo:
git push -u origin master
You have now created a remote documentation repo on GitHub.
For more information, refer to Adding an existing project to GitHub.