Cannot publish unborn head что делать
Перейти к содержимому

Cannot publish unborn head что делать

  • автор:

Cannot publish unborn head

I know there are other questions on here about this issue, but this case is different because it’s not caused by an empty repo folder or anything, and I’ve been pushing changes to this same repo using GitHub desktop for some time. After I type my changes into the summary window, I hit Commit to Master (branch is already set to master, like always). But I get the unborn head issue, along with the alert that my repo’s name is too long. Again, this has never happened, and the name has never been an issue previously. Here’s a screenshot for reference:

Does anyone know what might be causing this?

2 Answers 2

The error is due to a file in "Desktop/MY REPOS/The-Tech-Academy-C-Sharp-Coding-Projects/AppData/Local/Microsoft/VisualStudio/15.0_8067392e/VTC/" having a name that is too long. The filename looks like it is generated by a tool, not written by you. In fact it looks like the whole "Desktop/MY REPOS/The-Tech-Academy-C-Sharp-Coding-Projects/AppData/Local/Microsoft/" directory is probably not code that you are working on yourself.

With version control, it is best to ignore any files and folders that are generated somehow, such as this "Microsoft" folder. With git, you can do that in your .gitignore file with the following line, assuming that "Desktop/MY REPOS/The-Tech-Academy-C-Sharp-Coding-Projects/" is your project root:

In fact, if "AppData" contains only generated files, then you can even ignore just that.

I was using Sublime Text ver 3.2.1 working on a fresh copy of laravel in wamp. I had this issue of ‘cannot publish unborn head’ when using GitHub Desktop to publish for the first time. Solved by typing something in the title under Summary. As an aside, I included .editorconfig in my gitignore file.

Not the answer you’re looking for? Browse other questions tagged github or ask your own question.

Related
Hot Network Questions

To subscribe to this RSS feed, copy and paste this URL into your RSS reader.

site design / logo © 2019 Stack Exchange Inc; user contributions licensed under cc by-sa 4.0 with attribution required. rev 2019.11.15.35459

Cannot publish a bootstrap website from my local computer through github desktop. It’s states: cannont publish unborn head. What does it mean? What changes should I do?

1 Answer 1

The reason is that your repository is empty and you should make atleast a readme file. It worked in case of mine.

Not the answer you’re looking for? Browse other questions tagged github or ask your own question.

Related
Hot Network Questions

To subscribe to this RSS feed, copy and paste this URL into your RSS reader.

site design / logo © 2019 Stack Exchange Inc; user contributions licensed under cc by-sa 4.0 with attribution required. rev 2019.11.15.35459

Такая вот ситуация.

Имеем репозиторий на сервере /var/www/git/repository/testdeploy.git

Имеем следующий хук (post-update)

Имеем каталог /var/www/testdeploy где лежит скажем так развернутый проект (по факту просто рабочая копия репозитория)

Права у /var/www/testdeploy, /var/www/testdeploy/.git/

Пользователь git добавлен в группу httpd

https://amdy.su/wp-admin/options-general.php?page=ad-inserter.php#tab-8

Пробую с локальной машины сделать git push origin master

Как так то? Почему git запцущеный из под пользоваеля git не видит что он находится внутри группы httpd

Права у данного файла:

Причем интересная особенность, если я этот хук выполню из консоли на удаленной машине из под пользователя «git», то процесс пройдет нормально.

  • Вопрос задан более трёх лет назад
  • 4495 просмотров

Под другим юзером делаю со своего компа по удаленке. В том то и проблема я проверял, до хука доходит.
Проверял путем элементарного прописывания echo «Что-нибудь» в файле хука (post-update)
git обновляет ветку в репозитории /var/www/git/repository/testdeploy.git после чего выолняет хук и вываливается на комманде
git pull origin master

Если просписать владельцем git для каталога /var/www/testdeploy то все Ок. Складывается ощущение что при выполнении хука
git не понимает что он находится в группе httpd.

Github – “Cannot publish, unborn head” error message

I know there are other questions on here about this issue, but this case is different because it's not caused by an empty repo folder or anything, and I've been pushing changes to this same repo using GitHub desktop for some time. After I type my changes into the summary window, I hit Commit to Master (branch is already set to master, like always). But I get the unborn head issue, along with the alert that my repo's name is too long. Again, this has never happened, and the name has never been an issue previously. Here's a screenshot for reference:
unborn head alert

Does anyone know what might be causing this?

Best Solution

The error is due to a file in "Desktop/MY REPOS/The-Tech-Academy-C-Sharp-Coding-Projects/AppData/Local/Microsoft/VisualStudio/15.0_8067392e/VTC/" having a name that is too long. The filename looks like it is generated by a tool, not written by you. In fact it looks like the whole "Desktop/MY REPOS/The-Tech-Academy-C-Sharp-Coding-Projects/AppData/Local/Microsoft/" directory is probably not code that you are working on yourself.

With version control, it is best to ignore any files and folders that are generated somehow, such as this "Microsoft" folder. With git, you can do that in your .gitignore file with the following line, assuming that "Desktop/MY REPOS/The-Tech-Academy-C-Sharp-Coding-Projects/" is your project root:

In fact, if "AppData" contains only generated files, then you can even ignore just that.

Github Desktop Cannot Publish Unborn Head

github desktop cannot publish unborn head

When you encounter the error “cannot publish unborn head” in GitHub Desktop, it typically means that the branch you are trying to push does not have any commits yet. In Git, a branch is considered “unborn” if it has no commits. In order to push a branch to a remote repository, it must have at least one commit.

To resolve this issue, you will need to make an initial commit to the branch before trying to push it again. You can make an initial commit by doing the following:

  1. Make changes to your local repository: Add or modify files in your local repository.
  2. Commit your changes: In GitHub Desktop, you will see the changes in the “Changes” tab, you can add a summary and a description for the commit, then click on the “Commit to <branch name>” button.
  3. Push your changes: Once you have made an initial commit, you should be able to push your changes to the remote repository by clicking on the “Push Origin” button.

Alternatively, you can also run the following command in Git Shell to create an initial commit:

It’s important to note that it is a good practice to always provide a meaningful commit message when making commits, to help keep track of the changes that were made.

How to fix “Cannot publish, unborn HEAD”

Sometimes applications give us very strange error messages and we have to rack our brains to understand exactly what the problem is and how to fix it. As for new developers, using Git as a version control software sometimes can be daunting at times, because of the weird error messages it spits out.

In this article, we walk around “Cannot publish, unborn HEAD” – a common Git error message which often cause new developers headache just to make it go away. We will also explain the concepts around it and how to avoid it in the future.

What is HEAD in Git?

Git HEAD diagram

HEAD is a pointer whose job it is to reference a specific commit in the repository. Usually it points to the last commit you made.

You can think of the HEAD as the reference to the “current branch”. You move, HEAD moves along with you.

To see what “current branch” you’re on, you can use the following command :

HEAD can also points to the last commit that was checked out into the working space. This behaviour is called detached HEAD.

Every time you use git checkout [commit_id] , you’re essentially moving HEAD to the commit with ID commit_id .

“Cannot publish, unborn HEAD”, what does it means?

So now that you know that HEAD is the “current branch”, you can ask : What about an empty Git repository? What does HEAD point to after I’ve just created a repository and did not commit anything to it? The answer to the questions above is exactly the reason behind the error.

Before you commit the first time in a new repository, the HEAD doesn’t exist. “Cannot publish, unborn HEAD” basically means you are attempting to publish a branch that has no commits.

Fix “Cannot publish, unborn HEAD”

The solution is very simple. If you’re using git command line interface, you can simply do a commit then push , the error message will immediately go away.

If you create a new repository from Github’s web-based interface, please follow the instruction provided to properly initialized and do the first commit.

Github create new repo

Alternatively, you can automatically add a README.md file by ticking in Add a README file when you create a new repository.

Github fix Cannot publish, unborn HEAD

If you don’t want any README in your repository, you can add a summary and description, then commit them to the branch.

Github Desktop simplify this process, you only have to input the Summary and Description then press Commit to master.

We hope that the article helps you understand why the error happens in the first place, and quickly fix it. You may be interested in our other articles about Git/Github as well :

Добавить комментарий

Ваш адрес email не будет опубликован. Обязательные поля помечены *