Home > other >  Using Git push from local to a child folder in Remote Repository (Not the root) - GitLab
Using Git push from local to a child folder in Remote Repository (Not the root) - GitLab

Time:02-02

In my remote repository I have a branch called 'MyProject' and have three sub folders :

MyProject (Root)

Folder1 : Code

Folder2 : Documents

Folder3 : Notes

I use the following command to push

git init
git add.
git remote add origin myUrl
git push -u origin  MyProject

However, all the files are pushed to the Root -> 'MyProject', while I need to push them to the 'Code' subfolder.

I've looked at this article but it doesn't give me a good insight to solve this issue

CodePudding user response:

If you already have a remote repository use git clone myUrl instead of git init and git remote add. You should then have the desired folder structure on your local host. Copy your contents to the code folder and add / commit / push them.

Possible duplicate of: Checkout subdirectories in Git?

  •  Tags:  
  • Related