치명적 : 'https://github.com'의 사용자 이름을 읽을 수 없음 : 해당 파일 또는 디렉터리가 없습니다.
Windows에서 GIT Bash를 사용하여 코드를 가져 오려고 할 때 다음과 같은 문제가 있습니다.
이미 여기에 제공된 허용 된 솔루션을 구현하려고 시도했습니다.
그러나 문제는 지속됩니다. 원점을 추가 / 제거한 후에도 동일한 오류가 발생합니다.
fatal: could not read Username for 'https://github.com': No such file or directory
다음 단계에 따라 SSH 키를 설정하십시오. https://help.github.com/articles/generating-ssh-keys
또는
git remote add origin https://{username}:{password}@github.com/{username}/project.git
대신이 오류가 발생하는 경우 :
치명적 : ' https://github.com '의 사용자 이름을 읽을 수 없음 : 오류 없음
그런 다음 Git을 버전 2.16
이상 으로 업데이트해야합니다 .
나는 똑같은 문제에 직면했습니다. 이 문제는 HTTPS URL을 사용하여 복제 한 다음 Windows에서 다음을 사용하여 Git Bash를 사용하여 변경 사항을 푸시하려고 할 때 발생했습니다.
git clone https://github.com/{username}/{repo}.git
그러나 SSH URL을 사용하여 복제 할 때이 문제가 발생하지 않았습니다.
git clone git@github.com:{username}/{repo}.git
짧은 답변:
git init
git add README.md
git commit -m "first commit"
git remote add origin https://github.com/{USER_NAME}/{REPOSITORY_NAME}.git
git push --set-upstream origin master
새 저장소가 아닌 경우 처음 세 줄을 무시하십시오.
자세한 설명 :
위의 답변 중 어느 것도 도움이되지 않았으므로 동일한 문제가 발생했기 때문에 저에게 도움이되는이 솔루션을 게시하기로 결정했습니다.
몇 가지 참고 사항 :
- SSH 키가 생성되었습니다.
- SSH 키가 github에 추가되었지만 여전히이 오류가 발생했습니다.
- 이 프로젝트를 위해 GitHub에 새 저장소를 만들고 설명 된 단계를 따랐습니다.
명령 줄 도구로 GitShell을 사용했습니다 (Windows의 경우 Mac에서는 Terminal.app을 사용합니다).
GitShell은 공식 GitHub 도구이며 https://windows.github.com/ 에서 다운로드 할 수 있습니다.
이것이 같은 문제를 가진 모든 사람에게 도움이되기를 바랍니다.
이 오류는 잘못된 HTTP URL을 복제하려고 할 때도 발생할 수 있습니다. 예를 들어, 다음은 몇 글자 떨어져있는 GitHub URL을 복제하려고 할 때 발생하는 오류입니다.
$ git clone -v http://github.com/username/repo-name.git
Cloning into 'repo-name'...
Username for 'https://github.com':
Password for 'https://github.com':
remote: Repository not found.
fatal: Authentication failed for 'https://github.com/username/repo-name.git/'
하지만 실제로 Emacs 내부에서 발생 했으므로 Emacs의 오류는 다음과 같습니다.
fatal: could not read Username for ’https://github.com’: No such device or address
따라서 해당 URL에 그러한 저장소가 없다는 유용한 오류 대신 URL이 올바르지 않다는 것을 마침내 깨달을 때까지 야생 거위 추적에 나를 보냈습니다.
이것은 git 버전 2.7.4입니다.
나는 한 달 전에 나에게 일어났기 때문에 여기에 게시하고 있으며, 같은 야생 거위 추적에 다시 나를 보냈습니다. > :(
나를 위해 위에서 제안한 것에서 아무것도 작동하지 않았고, git pull
젠킨스 쉘 스크립트에서 사용 하고 분명히 잘못된 사용자 이름을 사용합니다. SSH로 전환하지 않고 고칠 수있는 방법을 찾기까지 오랜 세월을 보냈습니다.
사용자 폴더에서 .gitconfig 파일을 만들고 (아직없는 경우) 자격 증명을 https://user:pass@example.com
, 추가 정보 형식으로 입력합니다 . .gitconfig 파일이 해당 자격 증명에 링크 된 후 제 경우에는 다음과 같습니다.
[credential] helper = store --file /Users/admin/.git-credentials
이제 git은 항상 해당 자격 증명을 사용합니다. 나는 그것이 나를 도왔던 것처럼 누군가에게 도움이되기를 바랍니다.
이것은 시스템 자격 증명 캐시에 저장된 자격 증명의 문제입니다. 구성 변수 'credential.helper'가 wincred 또는 winstore로 설정되어 있고이를 지우는 데 실패했습니다. 제어판을 시작하고 Credential Manager 애플릿을 시작하는 경우 "git : https://github.com " 레이블이 지정된 일반 자격 증명 섹션에서 항목을 찾습니다 . 이 항목을 삭제하면 다음에 다시 생성되지만 자격 증명 도우미 유틸리티에서 새 자격 증명을 요청합니다.
계속하려면 ssh 대신 https를 사용하고 보안상의 이유로 사용자 이름과 암호를 입력하지 마십시오.
Github OAuth 토큰을 사용해 볼 수도 있습니다 . 그런 다음 git config remote.origin.url 'https://{token}@github.com/{username}/{project}.git'
또는git remote add origin 'https://{token}@github.com/{username}/{project}.git'
이것은 나를 위해 작동합니다!
최신 버전의 Git을 설치하여이 문제를 해결했습니다. 내가 설치 한 버전은 https://git-scm.com의 2.10.2입니다 . 여기에서 마지막 게시물을 참조하십시오 : https://www.bountysource.com/issues/31602800-git-fails-to-authenticate-access-to-private-repository-over-https
최신 Git Bash를 사용하면 자격 증명 관리자 창이 나타나고 사용자 이름과 암호를 입력 할 수 있습니다.
다음을 편집 ~/.gitconfig
하고 추가하십시오.
[url "git@gitlab.com:"]
insteadOf = https://gitlab.com/
다른 문제를 해결하지만 오류 코드는 동일합니다.
TL; DR : 읽기 / 쓰기가 가능한지 확인하십시오 /dev/tty
. 아니요이고 su
셸을 여는 데 사용한 적이 있다면 올바르게 사용했는지 확인하십시오.
나는 같은 문제에 직면했지만 Linux에서 문제를 발견했습니다. 내 자격 증명이 저장되어 있지 않으므로 항상 프롬프트에 입력합니다.
Username for 'https://github.com': foo
Password for 'https://foo@github.com':
git이 http (s) 연결을 처리하는 방법은 /usr/lib/git-core/git-remote-https
여기에서 strace를 볼 수 있습니다.
stat("/usr/lib/git-core/git-remote-https", {st_mode=S_IFREG|0755, st_size=1366784, ...}) = 0
pipe([9, 10]) = 0
rt_sigprocmask(SIG_SETMASK, ~[RTMIN RT_1], [], 8) = 0
clone(child_stack=NULL, flags=CLONE_CHILD_CLEARTID|CLONE_CHILD_SETTID|SIGCHLD, child_tidptr=0x7f65398bb350) = 18177
rt_sigprocmask(SIG_SETMASK, [], NULL, 8) = 0
close(10) = 0
read(9, "", 8) = 0
close(9) = 0
close(5) = 0
close(8) = 0
dup(7) = 5
fcntl(5, F_GETFL) = 0 (flags O_RDONLY)
write(6, "capabilities\n", 13) = 13
fstat(5, {st_mode=S_IFIFO|0600, st_size=0, ...}) = 0
read(5, "fetch\noption\npush\ncheck-connecti"..., 4096) = 38
write(6, "option progress true\n", 21) = 21
read(5, "ok\n", 4096) = 3
write(6, "option verbosity 1\n", 19) = 19
read(5, "ok\n", 4096) = 3
stat(".git/packed-refs", {st_mode=S_IFREG|0664, st_size=675, ...}) = 0
lstat(".git/objects/10/52401742a2e9a3e8bf068b115c3818180bf19e", {st_mode=S_IFREG|0444, st_size=179, ...}) = 0
lstat(".git/objects/4e/35fa16cf8f2676600f56e9ba78cf730adc706e", {st_mode=S_IFREG|0444, st_size=178, ...}) = 0
dup(7) = 8
fcntl(8, F_GETFL) = 0 (flags O_RDONLY)
close(8) = 0
write(6, "list for-push\n", 14) = 14
read(5, fatal: could not read Username for 'https://github.com': No such device or address
"", 4096) = 0
--- SIGCHLD {si_signo=SIGCHLD, si_code=CLD_EXITED, si_pid=18177, si_uid=1000, si_status=128, si_utime=6, si_stime=2} ---
exit_group(128) = ?
+++ exited with 128 +++
그래서 직접 부르려고했습니다.
echo "list for-push" | strace /usr/lib/git-core/git-remote-https my
결과 :
poll([{fd=3, events=POLLIN|POLLPRI|POLLRDNORM|POLLRDBAND}], 1, 0) = 1 ([{fd=3, revents=POLLIN|POLLRDNORM}])
recvfrom(3, "\27\3\3\1\32", 5, 0, NULL, NULL) = 5
recvfrom(3, "\307|4Q\21\306\334\244o\237-\230\255\336\25\215D\257\227\274\r\330\314U\5\17\217T\274\262M\223"..., 282, 0, NULL, NULL) = 282
openat(AT_FDCWD, "/dev/tty", O_RDONLY) = -1 ENXIO (No such device or address)
openat(AT_FDCWD, "/usr/share/locale/locale.alias", O_RDONLY|O_CLOEXEC) = 4
fstat(4, {st_mode=S_IFREG|0644, st_size=2995, ...}) = 0
read(4, "# Locale name alias data base.\n#"..., 4096) = 2995
read(4, "", 4096) = 0
close(4) = 0
openat(AT_FDCWD, "/usr/share/locale/en_US/LC_MESSAGES/libc.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/usr/share/locale/en/LC_MESSAGES/libc.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/usr/share/locale-langpack/en_US/LC_MESSAGES/libc.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/usr/share/locale-langpack/en/LC_MESSAGES/libc.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
write(2, "fatal: could not read Username f"..., 83fatal: could not read Username for 'https://github.com': No such device or address
) = 83
exit_group(128) = ?
+++ exited with 128 +++
그리고 여기에 왔습니다.
openat(AT_FDCWD, "/dev/tty", O_RDONLY) = -1 ENXIO (No such device or address)
...
write(2, "fatal: could not read Username f"..., 83fatal: could not read Username for 'https://github.com': No such device or address
) = 83
git-remote-https
을 통해 자격 증명을 읽으려고 시도 /dev/tty
하므로 작동하는지 테스트했습니다.
$ echo ahoj > /dev/tty
bash: /dev/tty: No such device or address
그러나 다른 터미널에서 :
# echo ahoj > /dev/tty
ahoj
이 사용자로 전환 한 것을 알았 su
으므로 셸을 종료하여 어떻게 명령을 사용했는지 su danman -
확인하고 다시 테스트했습니다.
~# su danman -
bash: cannot set terminal process group (-1): Inappropriate ioctl for device
bash: no job control in this shell
/root$ echo ahoj > /dev/tty
bash: /dev/tty: No such device or address
나는 아마도 메시지를 무시하고 계속 작업했지만 이것이 이유였습니다. 올바른 사용으로 전환했을 때 su - danman
모든 것이 잘 작동했습니다.
~# su - danman
danman@speedy:~$ echo ahoj > /dev/tty
ahoj
그 후 git은 올바르게 작동하기 시작했습니다.
다음과 같이 원격 URL을 바꿉니다.
git remote set-url origin https://<username>@github.com/<username>/<repo>.git
CMD와 같은 일반 Windows 셸을 사용해보십시오.
trying the CreativeMagic solution, the credential problem is confirmed:
prompt>>>Username for 'https://github.com'
So, I changed my origin url with
git remote set-url --add origin http://github.com/user/repo
and
git push --set-upstream origin master
'Program Tip' 카테고리의 다른 글
DLL 파일을 포함하는 JAR 파일을 만드는 방법은 무엇입니까? (0) | 2020.11.15 |
---|---|
Qt가 예외 처리를 사용하지 않는 이유는 무엇입니까? (0) | 2020.11.15 |
Webpack의 규칙 대 로더-차이점은 무엇입니까? (0) | 2020.11.15 |
셸 스크립트에 대한 단위 테스트 (0) | 2020.11.14 |
LRU 캐시 설계 (0) | 2020.11.14 |