I have created an empty git repository by use of gitolite and cloned it to my laptop. Usually, I can add files to it on my laptop on and push them to the repo but now an error occurs:
user@laptop Myproject % git clone newergit:Repo-Myrepo
Cloning into 'Repo-Myrepo'...
warning: You appear to have cloned an empty repository.
user@laptop Myproject % cd Repo-Myrepo
user@laptop Repo-Myrepo % vi test.txt
user@laptop Repo-Myrepo % git add test.txt
user@laptop Repo-Myrepo % git commit -m "add test file to repo"
[main (root-commit) 27aa970] add test file to repo
1 file changed, 1 insertion(+)
create mode 100644 test.txt
user@laptop Repo-Myrepo % git push origin master
error: src refspec master does not match any
error: failed to push some refs to 'newergit:Repo-Myrepo'
This used to work in the past but newly I am experiencing this error and don't know how to proceed?
Unfortunately,
git branch -al
did not resolve the problem
A git branch -avv
is only there to list the local and remote branches, for you to understand which branch was created (locally by your git commit and remotely by Gitolite)
If you use Git 2.37+, you can activate the
git config --global push.autoSetupRemote true
From there, a simple git push
(without any additional parameter) should be enough. It will pick the right branch name (the current one) and push it to the remote with remote tracking.