How to push an existing repo to codeberg when push to create is disabled?

I have a repo that I want to push to codeberg. First, I tried to push to create and got the message

$ git push --mirror
Forgejo: Push to create is not enabled for organizations.
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.

So I created a new repo, but wasn't allowed to push until I had pulled - which just deleted all my local files 🙄

So - what do I do?

16 points · 4 comments · view on lemmy.world

4 Comments

oz1sej@lemmy.world · 7 pts · 243d

Ok, I figured it out - I needed to

$ git remote set-url origin ssh://git@codeberg.org/OrgName/repoName.git

-and then I could push.

breadsmasher@lemmy.world · 4 pts · 243d (1 reply)

Have a look at this guide. You need to create the repo first I think before you push. Theres even a note talking about push to create

https://docs.codeberg.org/getting-started/first-repository/

oz1sej@lemmy.world · 3 pts · 243d

Thanks - I figured out how do to it - I had to use git remote set-url origin.

starshipwinepineapple@programming.dev · 2 pts · 243d

Sounds like you got it sorted but heres what i do:

  • setup new repo in codeberg but don't check the box to initialize the repo
  • for existing project, use git remote -v to verify your remotes. Update as necessary (git remote set-url [remote] [url]). If it's a new project you can just git init and add your remote.
  • first push you'll need to specify the remote such as git push origin and after that you'll be fine to use just git push