Newbie: git push does not work for me

could create a public project and tried follow the README.md

My local repository is committed and the remote origin URL has been set, exactly as mentioned in the README. The SSH key is loaded as shown by “ssh-add -l”. “ssh -T git@gitlab.com” answers a Welcome with my username.

When I do the “git push -uf origin main” I get asked for a Username. And, if I gave one for password, ending up in “Access denied”. I expected that the files are pushed and git gives some positve acknowledge back.

What to check next? What to improve?

The remote you’ve added (if you followed the README.md in the repo you linked) uses https for access. In that case it doesn’t really matter if SSH works.

I have no idea what works when you use gitlab.com, but I would try to change the remote to use SSH, by editing .git/config (there is probably a way using git remote, but I don’t know that). In the ‘[remote “origin”]’ section, edit ‘url’ to be ‘git@gitlab.com:ngong1/jpms_serviceloader_example.git’.

@grove For context, populating the Readme with instructions is a new workflow experiment: Experiment: Provide guidance and a template in the default README (&5461) · Epics · GitLab.org · GitLab After initializing the repo with a readme, the default instructions are not visible anymore. The readme workflow can help with the first steps, albeit there is confusion between SSH and https.

@ngong1 The remote is configured to use https as transport. Recommend creating a personal access token to avoid typing in your password.
If you want to use SSH as transport, proceed as suggested with editing the .git/config remote to use the git@… format.

Cheers,
Michael