devsetup1-9 Exercise 3: Push a Project and Clone It Back ========================================================= STEP 1: CREATE AN EMPTY REPOSITORY ---------------------------------- In the Gitea web page choose New Repository, name it composer-demo, and leave "Initialize repository" (README, .gitignore, licence) OFF. An empty repository has no history, so the push cannot clash with yours. STEP 2: PREPARE THE PROJECT --------------------------- cd ~/projects/composer-demo git status # "not a git repository" means: git init, then add and commit cat .gitignore # should contain vendor/ git add . git commit -m "Initial commit" # skip if already committed git branch -M main STEP 3: PUSH ------------ git remote add origin http://devserver:3000/YOURNAME/composer-demo.git git remote -v git push -u origin main Use your Gitea username and password when asked. If the name devserver does not resolve, use the machine's IP address in the URL, or fix the Base URL in app.ini. If the project already has a GitHub remote named origin, rename it first (git remote rename origin github) or use the name "gitea" here. STEP 4: CLONE IT BACK AND COMPARE --------------------------------- cd ~/projects git clone http://devserver:3000/YOURNAME/composer-demo.git composer-demo-copy diff -r --exclude=.git --exclude=vendor composer-demo composer-demo-copy # no output means the working files are identical ls composer-demo-copy # composer.json composer.lock app.php ... and NO vendor folder cd composer-demo-copy && composer install && php app.php # vendor/ is rebuilt from composer.lock and the program runs Clean up if you wish: rm -rf ~/projects/composer-demo-copy WHY THIS WORKS AS AN ANSWER --------------------------- The round trip (push, clone, compare) proves the server holds what you sent. The missing vendor folder shows .gitignore did its job, and composer install restoring it confirms that the lock file, not the folder, is the record of the dependencies, the same principle as Chapters 5, 6 and 7.