{ "id": "git-remote-clone-push", "title": "Clone, Commit, and Push to a Real Remote", "category": "Git", "isolation_type": "shared_namespace", "difficulty": "Medium", "type": "task", "weight": 5, "description": "## Clone, Commit, and Push to a Real Remote\n\nA bare Git repository already exists at `/srv/git-lab-remote.git` — this plays the role of a real remote (like Gitea or GitHub) without needing any account or network access. It is currently empty.\n\n**Your task:**\n\n1. Clone it to `/srv/git-lab-clone`\n2. Inside the clone, create a file `README.md` with any content\n3. Add and commit it\n4. Push your commit back to the remote (`origin`)", "hints": [ { "title": "The full sequence", "body": "`git clone` copies a remote repository (bare or not) into a new working directory, automatically configuring it as `origin`. `git push origin main` sends your local commits back to it.", "command": "git clone /srv/git-lab-remote.git /srv/git-lab-clone\ncd /srv/git-lab-clone\necho '# My Project' > README.md\ngit add README.md\ngit commit -m 'Add README'\ngit push origin main" } ], "setup_commands": [ { "command": "git config --global init.defaultBranch main" }, { "command": "git config --global user.email student@rootnode.local" }, { "command": "git config --global user.name 'RootNode Student'" }, { "command": "rm -rf /srv/git-lab-remote.git /srv/git-lab-clone" }, { "command": "git init -q --bare /srv/git-lab-remote.git" } ], "validation": { "commands": [ { "description": "the clone has origin configured pointing at the remote", "command": "git -C /srv/git-lab-clone remote get-url origin 2>/dev/null", "expected_output": "/srv/git-lab-remote.git", "match": "exact" }, { "description": "the commit actually reached the remote (not just the local clone)", "command": "git --git-dir=/srv/git-lab-remote.git log --oneline 2>/dev/null | wc -l | tr -d ' '", "expected_output": "^[1-9][0-9]*$", "match": "regex" }, { "description": "README.md is part of what was pushed", "command": "git --git-dir=/srv/git-lab-remote.git show --name-only --format= HEAD 2>/dev/null", "expected_output": "README.md", "match": "exact" } ] }, "default_namespace": "default", "teardown_commands": [ { "command": "rm -rf /srv/git-lab-remote.git /srv/git-lab-clone" } ] }