작성
·
575
답변 5
1
user@DESKTOP-SFQ7A3T MINGW64 ~/0_Jupyter_Notebook/Kaggle (master)
$ git init
Reinitialized existing Git repository in C:/Users/user/0_Jupyter_Notebook/Kaggle/.git/
user@DESKTOP-SFQ7A3T MINGW64 ~/0_Jupyter_Notebook/Kaggle (master)
$ git status
On branch master
Your branch is up to date with 'origin/master'.
Changes not staged for commit:
(use "git add/rm <file>..." to update what will be committed)
(use "git restore <file>..." to discard changes in working directory)
modified: .ipynb_checkpoints/0602_Dietanic(EDA)-checkpoint.ipynb
deleted: 0602_Dietanic.ipynb
Untracked files:
(use "git add <file>..." to include in what will be committed)
0602_Dietanic(EDA).ipynb
no changes added to commit (use "git add" and/or "git commit -a")
user@DESKTOP-SFQ7A3T MINGW64 ~/0_Jupyter_Notebook/Kaggle (master)
$ git add 0602_Dietanic(EDA).ipynb
bash: syntax error near unexpected token `('
맨 밑에 이렇게 뜹니다ㅠ
0
윈도우와 유닉스/리눅스계열 시스템에서 End-of-line(개행문자)의 차이때문에 생기는 경고입니다.
bash는 유닉스 계열의 환경을 재현한 프로그램으로, End-of-line(개행문자)이 LF로 표시됩니다.
(참고로 이를 Line Feed라고 합니다.)
하지만 실제로 작업해서 git add commit push 하려는 대상은 Windows에서 만들어졌죠?
Windows에서는 End-of-line을 CRLF(carriage return, line feed)로 표시합니다.
때문에
"너가 Windows에서 작성한 파일의 개행문자는 CRLF인데,
bash (유닉스시스템)에서는 이걸 LF로 바꿔 인식할거야~"
를 말해주는 경고메세지라고 보시면 됩니다.
추가로, 이 메세지를 보고 싶지 않으시다면
git config core.autocrlf true
명령어를 입력해주세요!
0
네 아마 된것 같습니다!
그런데 warning 이라고 뜨는데 어떤 내용인지 알려주실 수 있나요?
user@DESKTOP-SFQ7A3T MINGW64 ~/0_Jupyter_Notebook/Kaggle (master)
$ git add 0602_Dietanic\(EDA\).ipynb
warning: LF will be replaced by CRLF in 0602_Dietanic(EDA).ipynb.
The file will have its original line endings in your working directory
user@DESKTOP-SFQ7A3T MINGW64 ~/0_Jupyter_Notebook/Kaggle (master)
$ git status
On branch master
Your branch is up to date with 'origin/master'.
Changes to be committed:
(use "git restore --staged <file>..." to unstage)
new file: 0602_Dietanic(EDA).ipynb
Changes not staged for commit:
(use "git add/rm <file>..." to update what will be committed)
(use "git restore <file>..." to discard changes in working directory)
modified: .ipynb_checkpoints/0602_Dietanic(EDA)-checkpoint.ipynb
deleted: 0602_Dietanic.ipynb
0
$ git add 0602_Dietanic\(EDA\).ipynb
이와 같이 입력해보세요 :)
참고로 백슬래시 \ (혹은 원화 표시)는
"이 다음에 특수문자/예약어로 오해받을 수도 있는 단어를 쓸건데, 이건 그냥 문자열이니까 오해하지마~"
라는 의미를 담고 있습니다.
즉,
git add 0602_Dietanic(EDA).ipynb
라고만 하면, git은
"잉? ( 이거 뭐지? 갑자기 웬 소괄호지? " 하고 syntax error near unexpected token `(' 라는 에러를 띄우지만,
git add 0602_Dietanic\(EDA\).ipynb
라고 입력하면, git은 "아~ 소괄호들은 그냥 파일이름(문자열)이구나" 하고 인식하는거죠.
(참고로 이를 'escape sequence'라고 합니다 )
팁을 드리자면, git add 까지만 치고, TAB키(자동완성키)를 눌러보세요! 그럼 자동으로
$ git add 0602_Dietanic\(EDA\).ipynb
이렇게 표시될겁니다~
도움이 되었길 바랍니다!
0
minchul@DESKTOP-N87KQ5N MINGW64 ~/Desktop/test (master)
$ ls
'(hello).txt'
minchul@DESKTOP-N87KQ5N MINGW64 ~/Desktop/test (master)
$ git status
On branch master
Your branch is up to date with 'origin/master'.
Untracked files:
(use "git add <file>..." to include in what will be committed)
(hello).txt
nothing added to commit but untracked files present (use "git add" to track)
minchul@DESKTOP-N87KQ5N MINGW64 ~/Desktop/test(master)
$ git add .
minchul@DESKTOP-N87KQ5N MINGW64 ~/Desktop/test (master)
$ git commit -m "new flie"
[master f939eb1] new flie
1 file changed, 1 insertion(+)
create mode 100644 (hello).txt
minchul@DESKTOP-N87KQ5N MINGW64 ~/Desktop/test (master)
$ git push
Enumerating objects: 4, done.
Counting objects: 100% (4/4), done.
Delta compression using up to 4 threads
Compressing objects: 100% (2/2), done.
Writing objects: 100% (3/3), 290 bytes | 290.00 KiB/s, done.
Total 3 (delta 0), reused 0 (delta 0)
To https://github.com/kangtegong/test.git
4503ea6..f939eb1 master -> master
음 저는 문제없이 잘 push 되는 것 같습니다만,
흔히 파일 이름에 특수 문자를 사용하는 것은 권장하는 사항은 아닙니다 :)
혹시 어떤 에러메세지가 뜨시나요?