0

I've used git for a few projects but am still new to it. I just finished a project using github with no issues, but now I've started a new repo with only a readme in it, and when I try to push the new files into it I get this error: "Updates were rejected because the remote contains work that you do not have locally. This is usually caused by another repository pushing to the same ref. You may want to first integrate the remote changes (e.g., 'git pull ...') before pushing again. See the 'Note about fast-forwards' in 'git push --help' for details." I also get an error saying "repository 'https://github.com/willowskyed/shoppingcart.git/' not found", but that repo doesn't exist. I have an old one called shopcart but have not touched the files in several months. I've looked through similar issues on here and tried many solutions but nothing has worked so far. Thanks in advance for any help!

1 Answers1

0

To solve the problem that you can not push to the repository, it's due to you don't have the README locally:

git init
git remote add origin your_git_repository.git
git pull origin master
git add .
git commit -m "add new files"
git push origin master 
vhthanh
  • 209
  • 2
  • 6
  • Thank you for your help! The first part of this seemed to work, the readme file is now in my local folder. When I try to push any files I get this error "error: src refspec main does not match any" "error: failed to push some refs to 'https://github.com/willowskyed/portfolio.git'" – willow daigle Nov 19 '21 at 14:16
  • Try replacing `main` branch with `master` branch – vhthanh Nov 19 '21 at 15:08
  • I'd tried it before with main because that's where I set the repo up, but I tried with master instead and it worked! Thanks so much :) – willow daigle Nov 22 '21 at 20:06