Bandit31->32
Level Goal
There is a git repository at ssh://bandit31-git@localhost/home/bandit31-git/repo via the port 2220. The password for the user bandit31-git is the same as for the user bandit31.
Clone the repository and find the password for the next level.
Commands useful to solve the level
Helpful Reading Material
Where to start?
When we cat the README.md file, we see that it gives us a set of instructions. We have to create a key.txt file
and "push" it to our remote repository.
Part 1 : Stagging the key.txt file
We need to create a file called key.txt with the contents 'May I come in?'. The real challenge
here will be to stage the key.txt file for commit.
Hint
Using the git-add man page and the
Gitignore Documentation, can you figure out a way to stage the key.txt file?
Solution
When we run git add key.txt, we get the information that the key.txt file has been marked as ignored by git
(you can cat the .gitignore file in order to understand why). Thus running the following command :
git add -f key.txt
Part 2 : Pushing the key.txt file to the repository
Now that we've added the key.txt file to the stagging area, we need to push the file to the repository to validate the challenge.
Hint
Using the git-commit and the git-push man pages, can you figure out how to push the file to the repository?
Solution
Each commit must have a, preferably explicit, commit message. Then after taking our snapshot of the state
of the repository, we can then push our set of snapshots to the remote repository. We can use the -m
option of git commit to specify the message on the command line.
Here are our two commands :
git commit -m "explicit commit message"
git push
Full Solution
echo "May I come in?" > key.txtto create thekey.txtfile.git add -f key.txtto forcefully add thekey.txtfile to the stagging area.git commit -m "explicit message"to commit the changesgit pushto push our changes to the remote repository
You can now jump to the next level