I am trying to push my local code(my portfolio into my new Github repository. So created new repository. It says:
git remote add origin https://github.com/ex_username/ex_name.git
git branch -M main
git push -u origin main
Before pushing this repository, I was working on remote repository(which is another repository on my github) by making changes etc.
I used to push: git push origin main
The issue is when I am trying to push my new local folder(which is my portfolio) , the previous repository that I was working on github being pushed together
How can I push my existing folder separately into my new repository?
Here is a clarification, I was working on these repos on Github:

and here is next one. This repo is in Desktop/Project/20172018:

Currently I have "My Portfolio" folder that I want to push into new repo on Github. When I created new repo and pushing the local folder, then above existing repos are being pushed together:

What I want is this, just My Portfolio repo

First In local, in your new directory initiate git and then add and commit files to git using the below commands.
Second, create a new empty repo and then use the below commands in your project terminal to push the local repo to the remote repository.
incase if you're not on the branch main execute the below command (optional)
Finally
When you create a new GitHub repo they provide you with 2 option of pushing data:
You chose the second one, but the folder that contains all your projects is not a git repository yet, that's why you are having trouble pushing data.
Try doing the steps provided in the first option as to create a new repository for all your existing projects.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With