Git must be installed and can be downloaded here for almost all operating systems or is usually already part of your favorite distribution. Under FreeBSD e.g. a pkg install git
or under Debian an apt install git
is sufficient.
Attention, these steps only work if the 2FA authentication is not yet activated. If this is the case for you, then the specification with the username/password is not sufficient and we need additional steps.
However, the diversity of Git is much higher, especially when it comes to simultaneous local and online edits. But there are many more online resources.
Last updated:
New system, new luck. The first repository is quickly created.
However, in order to be able to use it online directly to its full extent, Initialization must be activated during creation.
Only with this, files can then be created or uploaded directly after the project creation via the Gitea page in the browser and then edited.
If the files created online from a repository are to be edited locally after all, they can be downloaded.
A repository always needs a dedicated folder locally, where the configuration and the files are stored.
For this, the following steps are necessary once:
mkdir REPOSITORYNAME
cd REPOSITORYNAME
git init
git config user.email "EMAIL"
git config user.name "NAME"
git remote add origin http://GITEAIP:3000/USERNAME/REPOSITORYNAME.git
This creates:
mkdir REPOSITORYNAME
, cd REPOSITORYNAME
, git init
) ,git config user.email "EMAIL"
, git config user.name "NAME"
) ,origin
(git remote add origin http://GITEAIP:3000/USERNAME/REPOSITORYNAME.git
) ,cd REPOSITORYNAME
git pull origin main
This will download:
origin
and the main branch main
are downloaded (git pull origin main
), at the first time also username and password are requested. main
is the current working version, so to speak. To keep the local files always up to date it is sufficient to repeat git pull origin main
in the folder REPOSITORYNAME before updating files locally.If there were local changes, they will be uploaded back to the git after editing.
The three commands are always necessary for this:
git stage .
git commit -m "COMMENT"
git push origin main
This will:
git stage .
), alternatively this can be only one file (git stage FILE
).git commit -m "COMMENT"
)origin
in the branch main
(git push origin main
)Let's say there is an existing directory on your machine that you want to migrate to Git.
For this it is sufficient to create a new repository, but here you should do it without the initialization, .....
... which is waiting for the first "contents".
On your computer, change to the directory with the existing files via console and follow these commands:
cd REPOSITORYNAME
git init
git config user.email "EMAIL"
git config user.name "NAME"
git remote add origin http://GITEAIP:3000/USERNAME/REPOSITORYNAME.git
This will prepare:
cd REPOSITORYNAME
, git init
) ,git config user.email "EMAIL"
, git config user.name "NAME"
) ,origin
(git remote add origin http://GITEAIP:3000/USERNAME/REPOSITORYNAME.git
) ,git checkout -b main
git add .
git commit -m "First commit"
git push origin main
This will:
git checkout -b main
, git add .
) ,git commit -m "COMMENT"
), so that they are versioned and changes are documentedorigin
branch main
(git push origin main
)Then the repository is also fully usable online.
In the example, my test directory contains only a single README.md file.
For further changes, the steps described above are necessary to [upload](#upload files) or [download](#download files) files.
Voilá