I'm just learning Git so please bear with me. I wrote some code locally and I would now like to push it to my remote server (origin). I get this error:
! [rejected] master -> master (fetch first)
error: failed to push some refs to 'ssh://website@host.website.com:2200/home/user'
Updates were rejected because the remote contains work that you do not have locally. This is usually caused by another repository pushing
The remote is v 2.4.1 and has this settings (output of git config --list):
core.repositoryformatversion=0
core.filemode=true
core.bare=false
core.logallrefupdates=true
receive.denycurrentbranch=updateInstead
Doesn't the last mean that I should be allowed to override conficts without raising an error?
I'm basically looking for the simplest setup: I don't develop on the server and I'm the only one with access to it, so I want whatever the dev machine pushes to win.
I saw this answer about making the remote repository bare, but the instructions were to delete everything in the folder but .git. That doesn't work for me because there are files in there that are not part of my project, but that I don't want to move
If I log into the remote repository and execute git status I see
Untracked files: (use "git add ..." to include in what will be committed)
...(long list of files)
nothing added to commit but untracked files present (use "git add" to track)
Addendum
I just did:
$ git push --force origin master
stdin: is not a tty
Counting objects: 3801, done.
Delta compression using up to 8 threads.
Compressing objects: 100% (3674/3674), done.
Writing objects: 100% (3801/3801), 6.95 MiB | 37.00 KiB/s, done.
Total 3801 (delta 2450), reused 0 (delta 0)
error: Untracked working tree file 'cacert.pem' would be overwritten by merge.
To ssh://website@host.website.com:2200/home/user
 ! [remote rejected] master -> master (Could not update working tree to new HEAD)
error: failed to push some refs to 'ssh://website@host.website.com:2200/home/'
I'm thinking I can just delete the server's copy of that file and try again? The two files have the same content (it was a copy/paste job)
 
     
    