Noob, can't get `git push` working


Decided to try Gitea today by setting it up on my personal hosted server running Ubuntu 18.04.

I downloaded the v1.8.1 binary and gitea.service file, followed the install docs (including creating a ‘git’ user), completed the web-based setup process, and then created an organization and a repo within it. Everything was going great till I tried to git push -u origin master and was prompted for a username and password.

I tried the username/password for my Gitea user account, but it didn’t work. I tried ‘git’ as the username with no password, but it didn’t work. I went back to the web UI and added my SSH key to my user account, then again tried both ‘git’ and my username, but neither worked.

What might I be missing?


Did you initialize the repository in the UI or is this your initial commit?


I created an uninitialized repo (foo) via the web UI, then on my desktop:

$ mkdir foo
$ cd foo
$ touch .gitignore
$ git init
$ git add .gitignore
$ git commit -m "first commit"
$ git remote add origin https://<mydomain>.com/<myorg>/foo.git
$ git push -u origin master

Which is when I am prompted for user/pass.

Oh yeah, forgot to mention: I also tried adding the domain to my ~/.ssh/config to set the default username to ‘git’, which didn’t help:

$ cat ~/.ssh/config
Host git.<mydomain>.com
    User git

Update: I just realized I only ever tried the HTTPS method, not the SSH method. So, I created another empty repo, just like the first one, but this time I added git@git.<mydomain>.com:<myorg>/foo.git as the origin, and the git push worked fine with no auth prompts.

Sorry, I’ve never given much thought to the difference between the HTTPS & SSH methods, and just grabbed the first one I saw. I’ll just stick with the SSH method now.

1 Like