0
votes

I already created a repository in GitLab and I just want to add another project to it. After I finalized my opening project in VSC, I used the terminal in VSC to add this new project to one of my existing GitLab repositories, so I wrote these commands in VSC terminal:

git init
git add .
git commit -m "my message"
git remote add origin "my existing GitLab repository Url"
git push origin master

Then I instantly got an error. I was not even asked to enter my GitLab username and passwords. The error is: fatal: unable to access 'https://gitlab.com/MYExistingGitLabRepositoryUrl/tree/master/': The requested URL returned error: 503

I searched a lot for this error. I searched the GitLab documents, but I couldn't find how to add some folders or projects to an existing repository. Although, I found some opinion about "maybe your branch is protected". This is the Url: Fix GitLab error: "you are not allowed to push code to protected branches on this project"?

However, I checked and my master branch was not protected.

Then, I tried another way but it did not go well! Now I have another problem. I copied my new projects folder in the directory of my existing repository on my pc and add my new projects to GitLab. Although my whole folder was inserted in my GitLab repository. But it has a weird look and it was not inserted like a folder. So enter image description hereI couldn't even access the whole content inside it!

Could you please help me what is the problem?

2

2 Answers

1
votes

HTTP code 503 is "service unavailable": the web site is down, or your proxy (if you're going through a proxy) is down or can't reach the server. This happens now and then when servers get overloaded and the solution for those cases is normally just to wait and try again. If the condition persists, find an administrator, check your network (including proxy) configurations, and so on.

Meanwhile, the subsequent problem you got was that you created what Git calls a submodule. Specifically, you tried to put a Git repository inside a Git repository. Git will not do this. Instead, Git puts in a sort of link—something Git calls a gitlink—that says: when checking out this commit in what is now a superproject, clone the submodule and check out this other commit in the new clone.

A gitlink is, technically, only half the information needed. The remainder of the information is the instructions that Git will need in order to run git clone so as to copy the submodule repository. The superproject is a superproject because it contains a gitlink. The gitlink says which commit to get from the submodule, but not how to get the submodule itself!

You almost certainly don't want any of this. Don't try to put a Git repository into another Git repository. There is a reason people who work with submodules sometimes call them sob-modules....

2
votes

First clone the remote repository using command

git clone path 

(copy the path from the remote repo, green button titled as Code)

Then copy paste your project files in the cloned repository then run commands

git add .
git commit -m "initial commit"
git push origin main