I created a new blank project in GitLab (in the browser). I checked the "Initialize repository with a README" box. But when opening it, it says: "The repository for this project is empty." I assume I still need to initialize a README.md file so that the main branch exists? So in the command line I tried (I am using windows 10):
git clone https://gitlab.com/url/myproject.git
cd myproject
git switch -c main
touch README.md
git add README.md
git commit -m "add README"
But it says:
C:\Users\me>git clone https://gitlab.com/ur/myproject.git
fatal: destination path 'myproject' already exists and is not an empty directory.
C:\Users\me>cd myproject
C:\Users\me\myproject>git switch -c main
fatal: A branch named 'main' already exists.
C:\Users\me\myproject>touch README.md
'touch' is not recognized as an internal or external command,
operable program or batch file.
C:\Users\me\myproject>git add README.md
C:\Users\me\myproject>git commit -m "add README"
On branch main
Your branch is based on 'origin/main', but the upstream is gone.
(use "git branch --unset-upstream" to fixup)
nothing to commit, working tree clean
My project is still empty and I can't add or push anything. Why?
EDIT: If I navigate to the project and do dir
, I get (I only deleted the volume serial number):
C:\Users\me\myproject>dir
Volume in drive C has no label.
Volume Serial Number is ...
Directory of C:\Users\me\myproject
13.12.2021 09:29 <DIR> .
13.12.2021 09:29 <DIR> ..
13.12.2021 09:29 0 README.md
1 File(s) 0 bytes
2 Dir(s) 112.515.997.696 bytes free