6

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

git clone https://myuser:[email protected]/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!

6
  • 1
    Check your gitignore file Jan 7, 2016 at 20:44
  • 2
    Possible duplicate of 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 7, 2016 at 20:44
  • My dot files are committed to the repository, and they are not listed in my .gitignore file
    – J Plana
    Jan 7, 2016 at 20:47
  • Normally, you should get all files. Are you using a Linux system? There, files starting with dots are hidden per default. Jan 7, 2016 at 20:48
  • 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 7, 2016 at 20:54

2 Answers 2

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 (.).

1
  • Hi Mathielo, thanks for your comment, I'm checking the files with ls -a
    – J Plana
    Jan 7, 2016 at 20:48
1

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.