I come across this error while uploading project to gitlab. I didn't clone from git but instead upload project. For pushing your code to gitlab you have two ways either using ssh or https. If you use https you have to enter username and password of gitlab account. For pushing you code to git you can use following one.
Pushing to Git for the first time
>$ cd
>$ mkdir .ssh;cd .ssh
>$ ssh-keygen -o -t rsa -b 4096 -C "[email protected]"
The -C parameter is optional, it provides a comment at the end of your key to distinguish it from others if you have multiple. This will create id_rsa (your private key) and id_rsa.pub (your public key). We pass our public key around and keep our private key — well, private. Gitlab’s User Settings is where you would then add your public key to your account, allowing us to finally push.
In your project location(Directory) use below command
git init
It Transform the current directory into a Git repository. This adds a .git subdirectory to the current directory and makes it possible to start recording revisions of the project.
Push Using https path
git push --set-upstream https://gitlab.com/Account_User_Name/Your_Project_Name.git master
Push Using ssh path
git push --set-upstream [email protected]:Account_User_Name/Your_project_Name.git master
— set-upstream: tells git the path to origin. If Git has previously pushed on your current branch, it will remember where origin is
master: this is the name of the branch I want to push to when initializing