I foolishly deleted a file from github using my webbrowser rather than the directory I had stored on my Mac.
Every morning I run a certain process using the following shell script using crontab:
#!/bin/sh
cd /Users/myCpu/Documents/GitHub/repository
git -C /Users/myCpu/Documents/GitHub/repository add -A
git -C /Users/myCpu/Documents/GitHub/repository commit -m “Daily update.”
git -C /Users/myCpu/Documents/GitHub/repository push
I get the following messages:
! [rejected] main -> main (fetch first)
error: failed to push some refs to ‘https://github.com/userName/repository’
hint: Updates were rejected because the remote contains work that you do
hint: not have locally. This is usually caused by another repository pushing
hint: to the same ref. You may want to first integrate the remote changes
hint: (e.g., ‘git pull …’) before pushing again.
hint: See the ‘Note about fast-forwards’ in ‘git push –help’ for details.
I’ve looked around and tried various troubleshooting links such as this one or this one and nothing seems to work. I can push and it doesn’t have a problem but it seems to hate my commits.
What am I doing that these solutions aren’t working for me? Again, I have a directory on my desktop /Users/macMini/Documents/Github/Repository that I push to Github/repository. It just isn’t going through and nothing I’m looking at is doing the trick.