6

I'm cloning a repository from Github with GIT, in a remote environment running CentOs, using:

git clone https://myuser:mypass@github.com/Myrepository/repo.git

and is checking out all the files, except the ones starting with a dot

.htaccess .htpasswd

Notes:

  1. The missing files show up on the Github repository

github

  1. These files are not included in .gitignore
  2. I'm listing the files on the server by using ls -a command

server

Is there any flag I need to add in order to checkout these files too?


[SOLUTION]

The problem wasn't with the git clone command, the missing dotfiles were due to another command executed afterwards

mv /path/one/* /path/two

Which moved everything except the dotfiles.

Thanks for your replies!

J Plana
  • 308
  • 2
  • 14
  • 1
    Check your gitignore file – Abhishek Patel Jan 07 '16 at 20:44
  • 2
    Possible duplicate of [Force git to add dotfiles to repository](http://stackoverflow.com/questions/2352455/force-git-to-add-dotfiles-to-repository). CAVEAT: Make sure you've added/committed the .dot files to your remote repository first, before you try cloning again. – paulsm4 Jan 07 '16 at 20:44
  • My dot files are committed to the repository, and they are not listed in my .gitignore file – J Plana Jan 07 '16 at 20:47
  • Normally, you should get all files. Are you using a Linux system? There, files starting with dots are hidden per default. – Elias Holzmann Jan 07 '16 at 20:48
  • Can you run `git status`? does it say anything about the missing files? – Ferrybig Jan 07 '16 at 20:52
  • 1
    If the files were committed to the remote repository, then git clone should absolutely copy them. They're either not actualy in the repo (my guess) or you're not displaying them (for *nix, you must `ls -a`). Try `git ls-tree -r master --name-only` – paulsm4 Jan 07 '16 at 20:54

2 Answers2

5

Please note that "dotfiles" are usually hidden by default in most operating systems. This applies whether you are using User or Command Line Interface.

If using CLI try adding -a flag to ls when listing the files in the git repo:

ls -a

As seen in man ls:

-a Include directory entries whose names begin with a dot (.).

mathielo
  • 6,725
  • 7
  • 50
  • 63
2

Based on your post, I honestly believe the dot files in question were never actually added to the git index and committed.

Please review this link:

To "see" hidden .dot files on a *nix host (OSX, Linux, BSD, etc), use ls -a

To see the files under Git control in your remote repo, use git ls-tree -r master --name-only or simply git ls-files.

It also wouldn't hurt to double-check your .gitignore file(s). Remember - any subdirectory might have it's own, separate .gitignore.

'Hope that helps

ADDENDUM:

Thank you for the additional info you posted:

Notes:

  1. The missing files show up on the Github repository

Github screenshot

This definitely shows the files exist on the remote filesystem (good!). But I'm not sure they're necessarily under git control. Again: git ls-tree -r master --name-only can tell you for sure what is and isn't under Git control.

Community
  • 1
  • 1
paulsm4
  • 114,292
  • 17
  • 138
  • 190