Frage

I created a bare Git repo on my production server. I then pushed my local repo to the bare repo and that worked. However, I then realized that I should have pushed my production repo to bare instead, because my local is outdated. So I tried that but I got an error. So I tried creating a 'production' branch on bare and pushing to that. The problem is that when I do 'git push /var/www/html.git (my bare repo)' it reports that it cannot update 'master'. How do I push to the 'production' branch on bare? (I have also tried 'git push master production' but this did not appear to be referencing the bare repo's 'production' branch)

War es hilfreich?

Lösung

Since you've just created your bare repository, I would say that the simplest thing to do is to delete it, recreate it, then push from your production repo to your new fresh bare.

You don't provide any error message, so I don't know exactly why pushing from production after push from local does not work, but it's probably because your branches have diverged, and you are facing a non forward push.

Instead of delete your bare repository, you could try running git push -f origin master:master from your production repository, where origin is your bare repository.

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top