Saturday, February 26, 2022

Solution for Git Error : fatal: Not a valid object name: 'master'.

 fatal: Not a valid object name: 'master'. 


We are getting this error due to master branch is not present . 

so we have to create empty master branch :


Solutions:

[root@oracle19c production]# git branch dev

fatal: Not a valid object name: 'master'.

[root@oracle19c production]#

[root@oracle19c production]#

[root@oracle19c production]# git commit --allow-empty -m "anurag"

[master (root-commit) 47e4721] anurag

[root@oracle19c production]#

[root@oracle19c production]# ls -la

total 0

drwxr-xr-x. 1 root root   8 Feb 26 17:45 .

dr-xr-x---. 1 root root 230 Feb 26 17:45 ..

drwxr-xr-x. 1 root root 134 Feb 26 17:48 .git

[root@oracle19c production]#

[root@oracle19c production]#

[root@oracle19c production]# git branch dev

[root@oracle19c production]#

[root@oracle19c production]#