In previous article, I show howto setup Git Server on Windows with OpenSSH. In this article, I will show howto setup Gitea on Windows.
1. Download & Install Gitea
Select a latest Gitea built for Windows and download it from: https://dl.gitea.io/gitea (e.g. gitea-1.9.6-windows-4.0-386.exe depending on your Windows).
Copy this file to a folder (e.g. C:\Gitea) and rename it to gitea.exe.
Run C:\Gitea\gitea.exe from Windows cmd:
Go to http://127.0.0.1:3000/ to configure initial configuration database. Gitea supports Microsoft SQL, MySQL, PostgreSQL and SQLite databases. Click "Sign In" button on the top left, then choose a database type you had, for me I select MSSQL:
Fill in necessary info. In Optional Settings >> Administrator Account Settings, let add an username (e.g. giteaadmin), it will be used as the administrator account for Gitea.
Then click "Install Gitea" button. After that you can sign in to the Gitea portal.
To change settings, you can modify the file C:\Gitea\custom\conf\app.ini, for example I add below lines to make English as default language for the Gitea portal:
[i18n]2. Run Gitea as Windows service
LANGS = en-US
NAMES = English
To start Gitea portal, you must run C:/Gitea/gitea.exe from Windows cmd or PowerShell. For convinient, let create a Windows service to start it automatically.
Terminate C:/Gitea/gitea.exe if it is running, open Windows cmd as Administrator and run the following command:
sc create GiteaService start= auto binPath= ""C:\Gitea\gitea.exe" web --config "C:\Gitea\custom\conf\app.ini""Open Windows Services and start GiteaService, then open website http://localhost:3000/ to check if working.
3. Create project repo and add user (collaborator)
Sign-in with admin user, on the Dashboard >> Repository area click + button to add new project repo:
Fill in project info:
Click "Create Repository" button. Now you have a repo for your project. Creator will be administrator for this repo as default.
Next let create user and add it to the project. Go to Site Administration >> User Accounts >> click Create User Account button to create new user:
Open the project, from its Settings >> Collaborators >> key the username of collaborator then click Add Collaborator button:
4. Work as a collaborator on Git portal
Create user for each collaborator (developer). On the PC of collaborator, open Gitea portal via link: http://<IP server>:3000/ (e.g. http://192.168.10.101:3000/).
In case of you want to access your projects via Internet, you can setup https with a domain. See guidelines here: https://docs.gitea.io/en-us/https-setup/
In case of you just want to access your projects within your LAN/VPN, you can simply use server IP.
After login, each developer will see projects joined. For example:
Pay attention on the http link of Git project, e.g.: http://localhost:3000/itgitad/TestProject.git
Replace localhost by server IP (e.g. http://192.168.10.101:3000/itgitad/TestProject.git) ==> you will have the right link of this Git project for working in local repo.
On this portal, developer can use functions like on GitHub.com. Oh lala...
5. Work on local repo
On your computer, open Windows cmd, cd to the folder that you want to make a local repo for your project, run the following commands:
git initAfter above commands, it will download latest info + source from remote repo to your local repo. Change/add a file, then push to the server:
git remote add origin http://192.168.10.101:3000/itgitad/TestProject.git
git pull origin master
git add NewFile.txtIt will pop up to ask username & password ==> enter username & passowrd created ont the Gitea web portal. Now open the Gitea portal, you will see NewFile.txt.
git commit -m "add NewFile"
git push origin master
You can use Visual Studio Code for working with your Git project.
Have a fun when reading. Bye!