i create a file hello.txt
in hello
folder inside repocentral
folder with command-line.
The commnand-line i use to create them:
git init repocentral
cd repocentral
mkdir hello
cd hello
echo "hello everyone" > hello.txt
But when i use this command-line, it only have folder dev1
without everything inside
git clone repocentral dev1
i ever try use ls
in dev1
folder but it hollow !!
i want ask reason why my git clone are not working and how to fix it!
git clone
is working. You never committed anything to repocentral
, the repository is empty, so you cloned an empty repository. git clone
clones the committed changes, not the files sitting in the directory.
You might be used to other software which auto-saves for you. Version control is different. Git does not automatically track files in the repository directory, nor does it automatically record changes. You must tell it exactly which files to track and what changes to commit to the repository with git add
and git commit
. Having to consider what is committed, and recording why the change was made, is important for version control.
Read 2.2 Git Basics - Recording Changes to the Repository to learn more.