There is a git repository at ssh://bandit31-git@bandit.labs.overthewire.org/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.
hint: git
이번에도 git clone인데 웬일로 bandit31서버에 새로운 파일이 있었습니다.
email과 username을 알려줬네요
bandit31@bandit:~$ la -al
total 24
drwxr-xr-x 2 root root 4096 Oct 14 09:26 .
drwxr-xr-x 150 root root 4096 Oct 14 09:29 ..
-rw-r--r-- 1 root root 220 Mar 31 2024 .bash_logout
-rw-r--r-- 1 root root 3851 Oct 14 09:19 .bashrc
-rwxr-xr-x 1 root root 59 Oct 14 09:26 .gitconfig
-rw-r--r-- 1 root root 807 Mar 31 2024 .profile
bandit31@bandit:~$ cat .gitconfig
[user]
email = bandit31@overthewire.org
name = bandit31
우선 하던대로 repo 폴더를 clone해오겠습니다
┌──(miso㉿Miso)-[~]
└─$ git clone ssh://bandit31-git@bandit.labs.overthewire.org:2220/home/bandit31-git/repo
Cloning into 'repo'...
_ _ _ _
| |__ __ _ _ __ __| (_) |_
| '_ \ / _` | '_ \ / _` | | __|
| |_) | (_| | | | | (_| | | |_
|_.__/ \__,_|_| |_|\__,_|_|\__|
This is an OverTheWire game server.
More information on http://www.overthewire.org/wargames
backend: gibson-0
bandit31-git@bandit.labs.overthewire.org's password:
remote: Enumerating objects: 4, done.
remote: Counting objects: 100% (4/4), done.
remote: Compressing objects: 100% (3/3), done.
remote: Total 4 (delta 0), reused 0 (delta 0), pack-reused 0
Receiving objects: 100% (4/4), done.
┌──(miso㉿Miso)-[~]
└─$ ls
bandit26.sshkey repo
┌──(miso㉿Miso)-[~]
└─$ cd repo/
┌──(miso㉿Miso)-[~/repo]
└─$ ls
README.md
┌──(miso㉿Miso)-[~/repo]
└─$ cat README.md
This time your task is to push a file to the remote repository.
Details:
File name: key.txt
Content: 'May I come in?'
Branch: master
읽어보니까 로컬 branch에 있는 master reference를 remote branch로 보내라고 하네요.
(텍스트 파일이름은 key.txt | 파일 내용은: May I come in?)
master branch 위치에서 key.txt를 만들어봅시다
┌──(miso㉿Miso)-[~/repo]
└─$ git branch -a
* master <-- 이미 master에 있네요
remotes/origin/HEAD -> origin/master
remotes/origin/master
┌──(miso㉿Miso)-[~/repo]
└─$ echo "May I come in?" > key.txt
┌──(miso㉿Miso)-[~/repo]
└─$ ls
key.txt README.md
┌──(miso㉿Miso)-[~/repo]
└─$ cat key.txt
May I come in?
이걸 이제 remote branch에 보내야겠죠?
remote에 push 하려면 순서가
- add
- commit
- push
형식으로 진행하면 됩니다.
┌──(miso㉿Miso)-[~/repo]
└─$ git add -f key.txt
┌──(miso㉿Miso)-[~/repo]
└─$ git commit -m "text.txt push"
Author identity unknown
*** Please tell me who you are.
Run
git config --global user.email "you@example.com"
git config --global user.name "Your Name"
to set your account's default identity.
Omit --global to set the identity only in this repository.
fatal: empty ident name (for <miso@Miso.localdomain>) not allowed
명령어를 하나씩 봅시다
git add -f key.txt
key.txt 를 강제(-f)로 stage에 올리겠다는 명령어
(.gitignore 설정에서 텍스트 파일이나 특정 파일을 무시하게 설정 돼있을 때 이를 무시하기 위해 -f(force) 옵션을 씀)
git commit -m "key.txt remote push"
방금 stage에 올린 key.txt를 commit 할 것이고, 저장 메세지는 "key.txt remote push" 이걸로 하겠다.
그런데 commit을 하려고 했더니 제가 누군지 물어보네요 그래서 친절하게 알려준 명령어 대로 설정을 해줬습니다
┌──(miso㉿Miso)-[~/repo]
└─$ git commit -m "key.txt remote push"
Author identity unknown
*** Please tell me who you are.
Run
git config --global user.email "you@example.com"
git config --global user.name "Your Name"
to set your account's default identity.
Omit --global to set the identity only in this repository.
fatal: empty ident name (for <bandit31@overthewire.org>) not allowed
┌──(miso㉿Miso)-[~/repo]
└─$ git config --global user.name "bandit31" <-- 이렇게
┌──(miso㉿Miso)-[~/repo]
└─$ git config --global user.email "bandit31@overthewire.org" <-- 22
그리고 다시 commit 하면?
┌──(miso㉿Miso)-[~/repo]
└─$ git commit -m "key.txt remote push"
[master 2799740] key.txt remote push
1 file changed, 1 insertion(+)
create mode 100644 key.txt
┌──(miso㉿Miso)-[~/repo]
└─$ git log
commit 2799740d58e4496a32a88659ceff986c9e1cd600 (HEAD -> master)
Author: bandit31 <bandit31@overthewire.org>
Date: Sat Dec 13 22:46:04 2025 +0900
key.txt remote push
commit cd07323d7f306c783ace9cbd45668f9c7f621122 (origin/master, origin/HEAD)
Author: Ben Dover <noone@overthewire.org>
Date: Tue Oct 14 09:26:24 2025 +0000
initial commit
제가 쓴 메세지 대로 commit 됐죠?
마지막으로 push 해주면 됩니다
┌──(miso㉿Miso)-[~/repo]
└─$ git push
_ _ _ _
| |__ __ _ _ __ __| (_) |_
| '_ \ / _` | '_ \ / _` | | __|
| |_) | (_| | | | | (_| | | |_
|_.__/ \__,_|_| |_|\__,_|_|\__|
This is an OverTheWire game server.
More information on http://www.overthewire.org/wargames
backend: gibson-0
bandit31-git@bandit.labs.overthewire.org's password:
Enumerating objects: 4, done.
Counting objects: 100% (4/4), done.
Delta compression using up to 18 threads
Compressing objects: 100% (2/2), done.
Writing objects: 100% (3/3), 331 bytes | 331.00 KiB/s, done.
Total 3 (delta 0), reused 0 (delta 0), pack-reused 0 (from 0)
remote: ### Attempting to validate files... ####
remote:
remote: .oOo.oOo.oOo.oOo.oOo.oOo.oOo.oOo.oOo.oOo.
remote:
remote: Well done! Here is the password for the next level:
remote: 3O9RfhqyAlVBEZpVb6LYStshZoqoSx5K
remote:
remote: .oOo.oOo.oOo.oOo.oOo.oOo.oOo.oOo.oOo.oOo.
remote:
To ssh://bandit.labs.overthewire.org:2220/home/bandit31-git/repo
! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'ssh://bandit.labs.overthewire.org:2220/home/bandit31-git/repo'
bandit 31 -> 32 password : 3O9RfhqyAlVBEZpVb6LYStshZoqoSx5K
'bandit' 카테고리의 다른 글
| [OverTheWire] bandit 33 -> 34 (0) | 2025.12.19 |
|---|---|
| [OverTheWire] bandit 32 -> 33 (0) | 2025.12.17 |
| [OverTheWire] bandit 30 -> 31 (0) | 2025.12.13 |
| [OverTheWire] bandit 29 -> 30 (0) | 2025.12.12 |
| [OverTheWire] bandit 28 -> 29 (0) | 2025.12.11 |