This issue comes with cloning a project with Shallow Clone and you want to push your codes to github.

What is shallow clone?

Shallow clone is just cloning a repository using --depth.
If you use Shallow clone to your local machine, it will not allow you to push your codes to your remote origin. You have to remove the shallow clone record to push your codes to remote repository.

How to remove shallow clone?

Here is a simple solution for this:

git fetch --unshallow https://github.com/this_is_the_source_url_from_where_you_did_clone_it.git

Now do your regular work, if you still have not set your new remote url, set it before to push

git remote remove origin
git init
git remote add origin https://github.com/your_new_repository_url_here.git
git push origin master

Change the branch name if you need. Set upstream as your own.

Go back to Tradecoder Dev Solution

Read more on Git- Github


If you find this information helpful, please feel free to share it