git init will not create git directories for me

后端 未结 8 1315
北荒
北荒 2020-12-31 19:06

I am new to Git. I can get a Git directory structure in a bare directory with git -init --bare. I can see where the git information is stored.

However, w

相关标签:
8条回答
  • 2020-12-31 19:38

    On Windows, git init may create a hidden .git folder. Go to Organize --> Files and Search Options --> and then check Show Hidden Files. That will unveil the .git folder.

    0 讨论(0)
  • Except if you have used the --git-dir option when running "git init", your .git directory MUST be in the directory. Perhaps you should look more carefully.

    In the same idea, perhaps have you set an environment variable GIT_DIR that change the place where the .git directory is stored. See http://git-scm.com/docs/git-init Remove this env variable if it's the case.

    And the added (staged) files are stored in the index file stored inside this .git directory...

    dir -AH (in powershell? otherwise it's dir /AH) works well for me...

    0 讨论(0)
  • 2020-12-31 19:43

    I am ultimately attmepting to create remote and local repositories completely from scratch. These are the commands I've used. If anyone has suggestions I'd gladly hear them.

    cd C:\Users\JimPC\Documents\pretendCloud

    git init --bare Project1

    cd C:\Users\JimPC\Documents\MyJava

    git clone C:\Users\JimPC\Documents\pretendCloud\Project1 Project1

    cd Project1

    dir >File01.txt

    git add File01.txt

    git commit -m "Initial State Commit"

    git push -u origin master

    After these commands, I believe I am ready to continue building my project on the master branch.

    0 讨论(0)
  • 2020-12-31 19:43

    It looks to me like it's simply not creating a repository. I run these commands in Windows 7:

    c:\Windows\System32>git init project1

    Reinitialized existing Git repository in c:/Windows/System32/project1/.git/

    c:\Windows\System32>cd project1

    The system cannot find the path specified.

    c:\Windows\System32>cd c:/Windows/System32/project1

    The system cannot find the path specified.

    c:\Windows\System32>git rev-parse --git-dir

    fatal: Not a git repository (or any of the parent directories): .git

    c:\Windows\System32>

    0 讨论(0)
  • 2020-12-31 19:47

    if the directory is recornized then once you dissable the protection of pciif in case the git is installed in other then main drive and check again it will be created

    0 讨论(0)
  • 2020-12-31 19:48

    A git init myrepo would always create an empty myrepo/ folder, with the myrepo/.git in it ready to get data.

    A git init --bare myrepo.git is for creating a bare repo you can push to:

    cd myrepo
    git remote add origin ../myrepo.git
    touch file.txt
    git add .
    git commit -m "First commit"
    git push -u origin master
    

    http://www.ossxp.com/doc/gotgit-en/images/en/fig-13-03-git-clone-2.png

    (Picture from gotgit)

    You wouldn't see file.txt on myrepo.git upstream repo though, since a bare repo has no working tree (hence "bare")

    In the repo, myrepo/.git/objects would contain the objects you are adding to the local repo: see Git Internals - Git Objects.
    From gotgit:

    http://www.ossxp.com/doc/gotgit-en/images/en/fig-06-02-git-repos-detail.png

    0 讨论(0)
提交回复
热议问题