Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
Celebration

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root

Avatar

1 badge earned

Collect

Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!

Challenges
Coins

Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.

Recognition
Ribbon

Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!

Leaderboard

How do I create a master branch?

I cloned a repo into an empty folder.  Usually when I do this a master branch is created automatically by default but for some reason this time it isnt.  When I add files to the cloned folder source tree does not recognize any working copy changes.  How do I resolve this?  If I try and just add a master branch it gives me the error

git -c diff.mnemonicprefix=false -c core.quotepath=false branch master
fatal: Not a valid object name: 'master

 

6 answers

My solution to this was to hit the "create .gitignore" file in the UI for the new repository. Bitbucket then created Master for me.

If this is still a problem, try checking you global .gitignore file. It could be that the file you want to add are ignored. I had a similar issue, and found the problem was that *.txt was added to my global .gitignore file, you can probably find the file in your user directory: ~/.gitignore

1 vote
Jobin Kuruvilla [Adaptavist]
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
Dec 30, 2015

You don't need to create master branch. When you add the new folder and commit the changes, it goes under "master" by default.

Yes I tried that and I can't commit anything because sourcetree doenst recognize that any files have been added ot the folder.  I think it may have something to do with the fact that there was another user that set this souretree up.  I have logged him out everywhere.

 

sourcetree.PNG

Jobin Kuruvilla [Adaptavist]
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
Dec 31, 2015

What happens when you navigate to that folder in command line and try "git status"?

Tim Crall
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
Jan 04, 2016

I would definitely recommend trying to resolve this issue from the command line first. One thing I've found sometimes when really weird stuff like this is happening is that it turns out the SourceTree is not looking at the directory on the local computer file's structure that I thought it was. Working at the command line makes this more obvious. The results of "git status" and "git branch" commands when in the repo at the command line will be informative.

Like Curtis_Heaslip likes this
0 votes
Tim Crall
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
Dec 30, 2015

Jobin's answer should normally be correct, but it sounds like you already know that and that something weird has happened.  What do you see if you do a "git branch" command at the terminal?

I would probably try just cloning again to see if it works as expected this time.  If not, try creating a new folder, cd'ing into it (at a unix or Git Bash terminal) and doing

git init
git remote set-url origin <remote-repo-url>
git pull

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events