Problems creating branchs -fatal: Not a Valid Object name: 'master'. ; bash: id: No such file or directory

Asked

Viewed 710 times

0

I started using git recently, created a local repository and a small project, versioned and uploaded it to an online repository, and no problems occurred, however, when I started developing another project (of course, in another directory), and when Versionar, a problem appeared to me, executed git init but when trying to create a branch I get that warning:

Fatal: Not a Valid Object name: 'master'.

(The branch name is an example, this error occurs with any branch name I place) I can use git checkout -b master and he returns the warning Switched to a new branch 'master', but when I execute the command git branch he doesn’t return me a list of branchs, it’s like he hasn’t created a branch, and when I try commit, it returns the following warning:

bash: id: No such file or directory.

I tried to git add before creating some branch, but the same "symptoms" occur. I also tried to clone an empty online repository to work on, but I still can’t create branchs or commit. I ask for your help. Does anyone have any idea what it might be??

  • Does this happen if you give a name without spaces? I don’t think you can have space on behalf of branch

  • run out git remote -v shows the remote repository that is connected?

  • Hello @Rafaeltavares, good afternoon. The names of the branchs have no spaces, error occurs in any names like: master, Alter-1, A, B, etc...

  • Hello @Ricardopunctual, good afternoon. Yes, when I perform git remote -v it shows me the remote repository that I am.

1 answer

1

Branch names cannot contain spaces. Instead of doing git checkout -b nome da branch, do git checkout -b nome-da-branch. Also make sure you have an updated version of Git.

  • Hello @Viniciusbrasil, good evening. All names I tried had no spaces, error occurs in any names like: master, Alter-1, A, B, and etc... Note: git is up to date, I downloaded the latest version from the official website.

  • Got it. 'Cause you asked the question fatal: Not a valid object name: 'nome da branch'.. Looks like he was using nome da branch as name. Edit the question with all the git commands you are running and the return of each?

  • I made the changes.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.