Reputation: 21
I have read access to a private GitHub repository. According to the instructions provided i need to clone the repository in my PC using "git clone" and the create a new branch using "git branch" The situation is that when I use the git branch i get the following message:
fatal: not a git repository (or any of the parent directories): .git
Can someone help me with this situation.
Thank you
Upvotes: 1
Views: 14587
Reputation: 122
In order for git to create a branch, the directory you're in need to be a git repository. A directory is a git repository in two cases:
git init
git clone "url"
A .git folder is created in both cases containing the git repository structure and files.
Now why did you get the problem? Simply because, even if you have clone the project so you have got a git repository in your local machine, git doesn't recognize it because you aren't inside the folder containing the git repository when you're trying to create a new branch.
So you simply need to open a terminal from the inside of the folder containing the git repository, and then do git branch "branch name"
.
Upvotes: 1
Reputation: 47
You have to be in the directory that was cloned. If you did that and it still didn't work, try cloning it again, because most likely you deleted the .git file by mistake.
Upvotes: 0
Reputation: 97
after you've cloned it you need to use the command "cd (dir name)". After you've done that then do the branch.
Upvotes: 2