Link to home
Start Free TrialLog in
Avatar of chalie001
chalie001

asked on

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

hi am not able to add branch in git hub
git remote add origin "https://github.com/chalie86/Python.git"

C:\paython\django\mysite>git branch django
fatal: Not a valid object name: 'master'.
Avatar of pepr
pepr

It is difficult to answer with the information you wrote. The page is private. Please show what the following commands display to you:
git remote -v 
    and
git branch
Avatar of chalie001

ASKER

git remote -v
origin  https://github.com/chalie86/Python.git (fetch)
origin  https://github.com/chalie86/Python.git (push)

C:\paython\django>git branch

C:\paython\django>

its public
How did you creat your C:\paython\django  content? What commands did you use to do that?

The git branch does return some non-empty list of branches -- under normal circumstances.

Well, the repository is public now (it was not -- it wanted the login + password). I have cloned the repository using the command git clone, like this:

e:\__Python\charlie01\ee29184586>git clone https://github.com/chalie86/Python.git
Cloning into 'Python'...
remote: Enumerating objects: 2213, done.
remote: Total 2213 (delta 0), reused 0 (delta 0), pack-reused 2213
Receiving objects: 100% (2213/2213), 69.25 MiB | 1.66 MiB/s, done.
Resolving deltas: 100% (577/577), done.
Updating files: 100% (3611/3611), done.
Receiving objects:  80% (1771/2213), 58.95 MiB | 1.74 MiB/s

Open in new window

After that I can change the directory to the \Python, and after git branch I get:

e:\__Python\charlie01\ee29184586\Python>git branch
* master

Open in new window

So, the master branch is definitely there.
i what to add branch django
Try gitk --all to see the structure of the commit points (the history), and then you can decide at what point you want to add the branch. By the way, what is the motivation to add new branch? Is it possible that you confuse the subdirectory with the branch?
what is the diffirence how to create sub directory

am geting
>gitk --all
'gitk' is not recognized as an internal or external command,
operable program or batch file.


If you want to add the subdirectory, just do it. If it is to be part of the same repository, you will just commit new files (in the new subdirectory). It is not related to branches in the sense that you do not need to create a branch to do that.

The gitk is the tool installed as the part of the official Git installation. See https://git-scm.com/ for the installation, and the https://git-scm.com/docs/gitk for the tool documentation. The gitk --all is what you want to use as a beginner. You will see the structure of your repository, including comments added to the commit points. You can also create/delete branch, create a tag, and many other things. It will help you understand how the Git works.
This question needs an answer!
Become an EE member today
7 DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform.
View membership options
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.