After running a bunch of commands trying to create and delete tags and branches, I see the following
What is it, and how should I handle it?
(Edited out content that turned out to be irrelevant)
After running a bunch of commands trying to create and delete tags and branches, I see the following
What is it, and how should I handle it?
(Edited out content that turned out to be irrelevant)
GitHub Support:
Please do not be alarmed, you have not broken anything on your repository. We introduced a prompt for repository owners and admins to protect their default branches ... the prompt [is] displayed to any admins with more than one branch in a repository.
I've confirmed this, creating branch creates banner, deleting branch deletes banner.
Git has no notion of protected branches. They are purely a GitHub/GitLab, etc. concept. You should simply click "Protect this branch" to enable branch protection.
I'm not sure why you're repeatedly trying to change the upstream and push to different branches. I'm assuming you're on the same branch running each of these pushes. But if that's the case then you're changing the upstream and which branch your targeting with each push. Git will protect you, but using -f
is very destructive since it disables a majority of the existing safety checks including potentially overwriting yours or someone else's work.
Also,
I figured maybe it's a built-in alarm for when someone's forcefully deleting stuff, but I'd like to be sure. Also, I'm sure you're right on -f, but I'll keep doing it - at least as long as it says so in an SO answer
Just because another SO post claims something is the answer, doesn't mean its the same answer in your situation. Trying the same commands over and over won't solve your issue, it'll only serve to frustrate you.
You're receiving an error that there are multiple refspecs with the name branch_name
. My guess is you have names that collide, such as a tag and a branch name that are the same, etc. As a general rule never have tags and branches with the same name. This can cause conflicts with git.
However, let's start simply here. Nowhere do I see any updating of the local refs. Simply updating the refs and then pushing might solve your issue.
git fetch
will keep your git client's refs information in sync with remote.git checkout branch_name
git push -u origin branch_name
Let's create a new branch with a name other than branch_name
since there seems to be some sort of conflict:
git fetch
git checkout -b my_new_branch branch_name
will create a new branch off of branch_name locally and switch to it.git push -u origin my_new_branch
If you absolutely must have branch_name
as the name, you can try to resolve the conflicts. I'm not sure if the below will work as its untested, based on speculation and I'm unsure how to recreate your scenario.
git fetch
will update the git client's refs so they're aware of changes on remote.git checkout branch_name
to checkout your local branchgit tag -d branch_name
will delete the corresponding local tag.git push --delete origin :refs/tags/branch_name
will delete tags on remote that have the conflicting name. You'll get an error if non existentgit push --delete origin branch_name
will permanently delete the remote copy of branch_name. Before running this make sure you have all the commits you expect on your local copy. Again, you'll get an error if the branch does not exist.git push -u origin branch_name
now.git fetch --prune
will remove all branch refs that do not exist on remote.git tag -a new_tag_name -m "tag message" sha1
recreate the release tag we previously deleted. sha1 is the commit hash of the release you previously tagged.git push origin new_tag_name
pushes the tag to remote and automatically creates a release in GitHub.I hope one of those solves your issue.