Managing repos
While these commands in teh examples will be linux focused they should also work on windows.
This page assumes that git is installed as per the install page
$REMOTE_URL
For these examples we are going to use $REMOTE_URL in place of the actual remote URL's, if you have an SSH key on your account use ssh format, elsewise use http.
This relates to a remote copy of teh repo you are planning to sync with.
| Type | URL |
|---|---|
| http | https://forgejo.skynet.ie/Skynet/example.git |
| ssh | ssh://forgejo@forgejo.skynet.ie:9001/Skynet/example.git |
Setup + Pulling
# create a folder for teh repo
mkdir project_name
# move into teh folder
cd project_name
# initialise git with the ``main`` branch
# if the default branch is called master then use that instead
git init -b main
# set teh remote url if you have one and set it to origin
# a repo can have multiple remotes in it
# replace $REMOTE_URL with teh appropiate remote for the repo you using
git remote add origin $REMOTE_URL
# pull down teh repo
git pull origin main
# might as well grab a copy of everything
# this step isnt required, but its sometimes nice to have.
git fetch origin
Pushing
You push to update a remote with any changes you have locally
# always pull before pushing
# rebasing is one of teh cleanest ways to merge incoming commits
# it basically layers your commits on top of others
git pull origin main --rebase
# Not much to pushing as long as ye pull it beforehand and resolve conflicts
git push origin main
# you can forcefully update teh remote so it is an exact copy of your repo
# beware that this might delete progress others have completed
git push origin main --force