How to connect to your self-hosted Gitea git repository from the command line

With your Gitea self-hosted Git server up and running, now you need to know how to connect to it from the CLI. Jack Wallen shows you how.

How to connect to your self-hosted Gitea git repository from the command line

You've deployed a Gitea self-hosted Git repository on your LAN and want to use it as a team repository for all of your in-house development projects. What do you do now? First, you create a repository and then you connect to that repository from the command line.

Once you've made that connection, you can work with the git/Gitea combination as though you were working with a repository on your local machine. It's a no-brainer that every developer should consider.

I want to walk you through how to do just that. Before you continue on, make sure to read up on how to install Gitea in my post: How to install the self-hosted Git server Gitea on Ubuntu 18.04.

What you'll need

  • A running instance of Gitea on your LAN
  • A user account on Gitea
  • Git installed on your local machine

With those bits in place, let's get this Git party started.

SEE: Resolve IT issues quickly with these 10 PowerShell cmdlets (TechRepublic download)

How to create a repository

The first thing to do is to create a repository on Gitea. To do this, log in to your Gitea account. Click the Repository tab in the upper-right hand corner and click the + button (Figure A).

Figure A


Creating a Git new repository in Gitea. 

In the resulting window (Figure B), fill out everything necessary for your new repository, and make sure to click the checkbox for Initialize Repository.

Figure B


Filling out the details for your new repository on Gitea.

When you've finished filling in the details, click Create Repository. 

And that's it, your repository is ready for connection.

How to connect to Gitea from the CLI

In order to make this work, you must first configure git with your email address and your name. To do this, open a terminal window and issue the commands:

git config --global EMAIL
git config --global "NAME"

Where EMAIL is your email address and NAME is your full name.

Once you've taken care of that configuration, it's time to interact with your new Gitea repository. The address of this repository will be in the form of:



  • SERVER_IP is the IP address of the Gitea server

  • USER is your username on the Gitea serve

  • REPOSITORY is the name of the repository you just created

For example's sake let's say repository address is:​

The first thing to do is to clone the repository with the command:

git clone

Once the repository has cloned, change into the newly created directory with the command:

cd TechRepublic

Now let's create a new file with the command:

echo Hello World > test.txt

We'll now add that file to the repository with the command:

git add test.txt

Next, we'll make our first commit to the repository with the command:

git commit -m "my first commit"

Finally, we'll push the commit to the Gitea repository with the command:

git push

If you head back to your repository on Gitea, you should see the test.txt file listed (Figure C).

Figure C


Our new Git commit is showing in the Gitea repository.

Click on that file name and you'll see Hello World (Figure D).

Figure D


The contents of the test.txt hosted in Gitea.

And that's all there is to it. You can now work with your Gitea repository as you would any remote repository, only knowing your work is safely guarded within the confines of your own LAN.

Also see

Developer young woman

Image: Getty Images/iStockphoto

By Jack Wallen

Jack Wallen is an award-winning writer for TechRepublic, The New Stack, and Linux New Media. He's covered a variety of topics for over twenty years and is an avid promoter of open source. For more news about Jack Wallen, visit his website jackwallen....