0

I have some code from a C# project which I trying to commit with Git into Bitbucket.

The C# code is in one folder and inside this folder are two other folders or projects, but when I try to commit these projects at the step when you call git add --all it shows a warning that I have two repositories in one, and only one of the projects is committed to Bitbucket.

There is only one remote repository for all of the c# code, and want to keep things together. The folder structure is as follows:

-Parent Folder -Project One Folder -Project Two Folder (this contains the solution file) 

As I said it is only the first folder Project One that is saved to Bitbucket. I have tried to upload each Project folder separately, but it throws an error saying there is not a repository for these folders.

So, my question is there a way with Git where I can upload from the Parent Folder both folders into one repository?

3
  • 1
    How did you initialize the repository? Did you just use git clone? There seem to be two local git repositories, i.e. two .git folders, maybe one in the parent folder and one in another folder? What exactly is the warning message git add --all is showing? Commented Mar 9, 2018 at 15:11
  • I did a git clone before doing anything, and then cd into the parent folder and did a git init, git add --all, git commit -m "Start", git remote set-url origin <url>, git push -u origin master. There was .git in the parent folder, nothing in the project one folder, and there was one in the second which I removed Commented Mar 9, 2018 at 15:34
  • Sorry, I managed to fix it now Commented Mar 9, 2018 at 15:49

1 Answer 1

1

The problem is that you did git clone, which creates a git repository, and then did git init on top of that, which initializes another repository. That explains the two-repository state you're in.

You should find out where the two .git folders are and delete the one that was not created by the clone. You can find out by taking a look inside the .git/config file: one of them should contain something like

[remote "origin"] url = git@your_bitbucket_url ... 

That is the one to keep! Delete the .git folder NOT containing an entry for the remote you cloned. That should fix your repository and allow you to commit and push.

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.