When I
git init
a folder it doesn’t create a master branch
This is true, and expected behaviour. Git will not create a master
branch until you commit something.
When I do
git --bare init
it creates the files.
A non-bare git init
will also create the same files, in a hidden .git
directory in the root of your project.
When I type
git branch master
it says “fatal: Not a valid object name: ‘master'”
That is again correct behaviour. Until you commit, there is no master branch.
You haven’t asked a question, but I’ll answer the question I assumed you mean to ask. Add one or more files to your directory, and git add
them to prepare a commit. Then git commit
to create your initial commit and master
branch.
Related Posts:
- How do I check out a remote Git branch?
- What is git tag, How to create tags & How to checkout git remote tag(s)
- What does ‘–set-upstream’ do?
- What does ‘–set-upstream’ do?
- Squash my last X commits together using Git
- Git merge hotfix branch into feature branch
- Git submodule update
- How to apply a patch generated with git format-patch?
- What does ‘git merge –abort is equivalent to git reset –merge when MERGE_HEAD is present.’ of Git merge man page mean?
- Abort a Git Merge
- How to delete a remote tag?
- Updates were rejected because the tip of your current branch is behind its remote counterpart
- How do I clone a specific Git branch? [duplicate]
- What does “Changes not staged for commit” mean
- Git : fatal: Could not read from remote repository. Please make sure you have the correct access rights and the repository exists
- git: fatal: Could not read from remote repository
- How do I update Homebrew?
- Git error when trying to push — pre-receive hook declined
- Remove files from Git commit
- How to solve SSL certificate: self signed certificate when cloning repo from github?
- Gitignore not working
- Could not open a connection to your authentication agent
- How to get just one file from another branch?
- How do I revert a Git repository to a previous commit?
- git checkout a single file from another branch and put in different folder
- How to revert multiple git commits?
- How do I fix a Git detached head?
- What is HEAD in Git?
- Why does git say “Pull is not possible because you have unmerged files”?
- What are the differences between git remote prune, git prune, git fetch –prune, etc
- How can I git stash a specific file?
- How to get the current branch name in Git?
- How can I git stash a specific file?
- Move the most recent commit(s) to a new branch with Git
- What does “Git push non-fast-forward updates were rejected” mean?
- How do I diff the same file between two different commits on the same branch?
- How to name and retrieve a stash by name in git?
- You have not concluded your merge (MERGE_HEAD exists)
- How to get the current branch name in Git?
- Stash just a single file
- Git – Ignore node_modules folder everywhere
- Git error on commit after merge – fatal: cannot do a partial commit during a merge
- Is there a “theirs” version of “git merge -s ours”?
- Meaning of the GitHub message: push declined due to email privacy restrictions
- Is there a command to undo git init?
- How to undo ‘git reset’?
- Download a single folder or directory from a GitHub repo
- Git and nasty “error: cannot lock existing info/refs fatal”
- How do I delete a local repository in git?
- git pull from master into the development branch
- Clone A Private Repository (Github)
- Throw away local commits in Git
- Hard reset of a single file
- How to remove remote origin from a Git repository
- .gitignore and “The following untracked working tree files would be overwritten by checkout”
- Is there a “theirs” version of “git merge -s ours”?
- How to clone a specific Git tag
- How do I copy a version of a single file from one Git branch to another?
- Git: cannot checkout branch – error: pathspec ‘…’ did not match any file(s) known to git
- Heroku: How to change a Git remote on Heroku
- Invalid VCS root mapping – 3 errors on my project
- Updates were rejected because the remote contains work that you do not have locally
- Undoing a ‘git push’
- What’s the significance of the “No newline at end of file” log?
- What is the difference between pull and clone in git?
- How do I clone a single branch in Git?
- Git update submodules recursively
- Do a “git export” (like “svn export”)?
- how to reset develop branch to master
- What does git push origin HEAD mean?
- “fatal: HttpRequestException encountered.” Error with GitHub/Bitbucket Repositories due to dropping TLS-1.0 support
- Git’s local repository and remote repository — confusing concepts
- How do i git push specific branch?
- fatal: could not read Username for ‘https://github.com’: No such file or directory
- git push origin master does not work
- How can I see which Git branches are tracking which remote / upstream branch?
- Git clone verbose output?
- Could not create work tree dir ‘example.com’.: Permission denied
- TortoiseGit-git did not exit cleanly (exit code 1)
- How to answer the git prompt in npm init for a local repo
- How to `git pull` while ignoring local changes?
- Uninitialize git repository
- How to create a local branch from an existing remote branch?
- Git says “Automatic merge failed”, what does it mean?
- How do I clone a subdirectory only of a Git repository?
- How to configure git bash command line completion?
- What is the .git folder?
- How to stop tracking and ignore changes to a file in Git?
- Updating and committing only a file’s permissions using git version control
- Create empty branch on GitHub
- Git – fatal: Unable to create ‘/path/my_project/.git/index.lock’: File exists
- WordPress and Git – What folders should I track?
- What is the usual process of saving changes made at the CMS level into source control?
- Collaboratively develop a WordPress site
- Pull latest stable release via git [closed]
- WordPress Core files not being ignored by Git
- Painless way to track remote Git repo for WordPress updates
- WordPress on git – need help with configuration
- Full site editor, hard-coded IDs in query blocks, and staging/dev servers
- How to retrieve the last modification date of all files in a Git repository