0
0
Linux CLIscripting~20 mins

Repository management in Linux CLI - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
Repository Mastery
Get all challenges correct to earn this badge!
Test your skills under time pressure!
💻 Command Output
intermediate
2:00remaining
What is the output of listing all configured remote repositories?
You run the command git remote -v in a repository with two remotes named origin and upstream. What is the expected output?
Linux CLI
git remote -v
Aremote origin https://github.com/user/repo.git\nremote upstream https://github.com/other/repo.git
Borigin https://github.com/user/repo.git\nupstream https://github.com/other/repo.git
Cfetch origin https://github.com/user/repo.git\npush origin https://github.com/user/repo.git\nfetch upstream https://github.com/other/repo.git\npush upstream https://github.com/other/repo.git
Dorigin https://github.com/user/repo.git (fetch)\norigin https://github.com/user/repo.git (push)\nupstream https://github.com/other/repo.git (fetch)\nupstream https://github.com/other/repo.git (push)
Attempts:
2 left
💡 Hint
The -v option shows URLs for fetch and push separately.
💻 Command Output
intermediate
2:00remaining
What is the output of adding a new remote repository?
You run git remote add backup https://example.com/backup.git in your repository. Then you run git remote. What is the output?
Linux CLI
git remote
Aorigin\nbackup
Bbackup
Corigin https://github.com/user/repo.git\nbackup https://example.com/backup.git
Dremote origin\nremote backup
Attempts:
2 left
💡 Hint
The git remote command lists remote names only.
🔧 Debug
advanced
2:00remaining
Why does this command fail to clone a repository?
You run git clone git@github.com:user/repo.git but get an error: Permission denied (publickey). What is the most likely cause?
Linux CLI
git clone git@github.com:user/repo.git
ASSH keys are not set up or not added to the SSH agent
BThe repository URL is incorrect and should use HTTPS
CYou need to run the command with sudo
DGit is not installed on the system
Attempts:
2 left
💡 Hint
The error mentions Permission denied (publickey) which relates to SSH authentication.
💻 Command Output
advanced
2:00remaining
What is the output of listing all branches including remote ones?
You run git branch -a in a repository with local branches main, dev and remote branches origin/main, origin/feature. What is the output?
Linux CLI
git branch -a
A* main\n dev\n origin/main\n origin/feature
Bmain\ndev\norigin/main\norigin/feature
C* main\n dev\n remotes/origin/main\n remotes/origin/feature
D* main\n dev
Attempts:
2 left
💡 Hint
The -a option shows local and remote branches with the remotes/ prefix.
🧠 Conceptual
expert
2:00remaining
What happens when you run git fetch --prune?
You run git fetch --prune in a repository. What is the effect of the --prune option?
AIt deletes all untracked files in the working directory
BIt removes remote-tracking references that no longer exist on the remote
CIt deletes local branches that have been merged
DIt resets the current branch to match the remote branch
Attempts:
2 left
💡 Hint
Pruning cleans up references to remote branches that were deleted.