Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to add existing repository to gitea from filesystem?

Tags:

gitea

I have some bare git repository on my filesystem where users do pull/push. I install gitea and can't find how to add it to gitea. Other git-management systems have something like "add repository from filesystem", "scan directory", etc. which added existing repo to system. How to add it in gitea?

like image 286
AeroSun Avatar asked Dec 14 '25 11:12

AeroSun


1 Answers

At the moment I migrate from Filesystem Repositorys to Gitea.

How this could be done is heavily discussed here (we used SSH), where I got the basis for my approach.

The following steps worked for me:

  1. Clone the repo.git folder to another location git clone path/to/repo.git

  2. Create an empty repo in Gitea. Either by hand or using the api

    curl \
      -X POST "http://localhost:3000/api/v1/user/repos" \
      -H "accept: application/json" \
      -H "Authorization: token MY_TOKEN*" \
      -H "Content-Type: application/json" \
      -d "{\"name\": \"REPO_NAME\"}" \
      -i
    
  3. Optionally transfer to a organization

    curl \
      -X POST "http://localhost:3000/api/v1/repos/CURRENT_OWNER/REPO_NAME/transfer" \
      -H "accept: application/json" \
      -H "Authorization: token MY_TOKEN*" \
      -H "Content-Type: application/json" \
      -d "{\"new_owner\": \"NEW_ORGANIZATION_OR_INDIVIDUAL\"}" \
      -i
    
  4. Push the repo to gitea

  • git remote add neworigin "http://localhost:3000/username/test.git"
  • git push neworigin --all
  • git push neworigin --tags

*https://docs.gitea.io/en-us/api-usage/

like image 116
Lukas Weber Avatar answered Dec 17 '25 00:12

Lukas Weber



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!