Git/GitHub을 마스터로 푸시할 수 없습니다.
Git/GitHub을 처음 접했는데 문제가 생겼습니다.테스트 프로젝트를 만들어 로컬 저장소에 추가했습니다.이제 원격 저장소에 파일/프로젝트를 추가하려고 합니다.
제가 한 일은 이렇습니다. (그리고 이것은 효과가 있었습니다.)
git remote add origin git://github.com/my_user_name/my_repo.git
이제 GitHub에 저장소를 푸시하려고 하면 다음 명령을 사용하여 다음 오류가 발생합니다 -
git push origin master
오류 -
fatal: remote error:
You can't push to git://github.com/my_user_name/my_repo.git
Use git@github.com:my_user_name/my_repo.git
. 이는 GitHub 시작 URL은 Git Hit Hub URL 되는 Git 을 을 하지 하여 을 는 하지 을 을 되는 .git://알 수 중 . 해야 를 에서 해야 를 에서 git@github.com:my_user_name/my_repo.git "하여 "smart http" 을 합니다.https://GitHub에서 저장소에 대해 보여주는 URL.
(업데이트: 놀랍게도, 몇몇 사람들은 제가 "https"가 "smart HTTP"를 의미한다고 생각했지만, 저는 그렇지 않았습니다. HTTP HTTP". Git에는 GitHub의 "dumb HTTP" .http아니면https은 아래 Git에서 사용하는 전송 프로토콜의 차이점은 아래 링크에서 설명합니다.)
원본 URL을 변경하려면 다음 작업을 수행하면 됩니다.
git remote set-url origin git@github.com:my_user_name/my_repo.git
아니면
git remote set-url origin https://github.com/my_user_name/my_repo.git
자세한 내용은 10.6 Git Internals - Transfer Protocols 에서 확인할 수 있습니다.
Mark Longair의 답변을 사용하되, 반드시 HTTPS 링크를 사용하여 저장소에 연결해야 합니다.
git remote set-url origin https://github.com/my_user_name/my_repo.git
그때 사용하시면 됩니다.git push origin master.
Longair를 사용한 Longair의 의 의 git remote set-url...꽤 분명합니다.이 섹션을 . .git/config 파일의 ".git/config "이 "을 "다 "을 "도 "을 "한 "의 "하여 "접 "y "u "e "s t f r o "
이전:
[remote "origin"]
fetch = +refs/heads/*:refs/remotes/origin/*
url = git://github.com/my_user_name/my_repo.git
이후:
[remote "origin"]
fetch = +refs/heads/*:refs/remotes/origin/*
url = git@github.com:my_user_name/my_repo.git
( ( 로, git remote set-url...호출하면 위의 변경 사항이 생성됩니다.)
이 문제를 처음 접하는 사람을 위한 간단한 해결책이 있습니다.
디렉토리의 합니다( 에서 .git 을 합니다 합니다 에서 ).config)를 변경합니다git:https:189.
[remote "origin"]
url = https://github.com/your_username/your_repo
Git 클라이언트를 업그레이드한 후 이 문제가 발생했는데 갑자기 저장소에서 푸시가 되지 않습니다.
어떤 오래된 리모콘이 잘못된 값을 가지고 있다는 것을 발견했습니다.url, 현재 활성화된 리모콘을 통해서도 동일한 값을 받았습니다.url잘 작동하고 있었습니다.
도 있었습니다.pushurlparam, 그래서 예전 리모콘에 추가하는 것이 나에게 효과가 있었습니다.
이전:
[remote "origin"]
url = git://github.com/user/repo.git
fetch = +refs/heads/*:refs/remotes/origin/*
pushurl = git@github.com:user/repo.git
참고: "config" 파일의 이 부분은 오랫동안 사용되지 않았지만 새 클라이언트가 잘못된 URL에 대해 불평했습니다.
[remote "composer"]
url = git://github.com/user/repo.git
fetch = +refs/heads/*:refs/remotes/composer/*
그래서 제가 추가를.pushurl이전 원격에 대한 매개 변수:
[remote "composer"]
url = git://github.com/user/repo.git
fetch = +refs/heads/*:refs/remotes/composer/*
pushurl = git@github.com:user/repo.git
이 오류는 다음과 같은 호출을 사용하여 레포오를 복제할 때 발생합니다.
git clone git://github.com/....git
이렇게 하면 기본적으로 변경사항을 푸시업할 수 없는 풀 전용 사용자로 설정됩니다.
내 레포를 열어서 고쳤어요.git/config파일 및 줄 바꿈:
[remote "origin"]
url = git://github.com/myusername/myrepo.git
대상:
[remote "origin"]
url = ssh+git://git@github.com/myusername/myrepo.git
이것.ssh+git의전.git사용자는 Github에서 선호하는 인증 메커니즘입니다.
여기에 언급된 다른 답변은 기술적으로 효과가 있지만, 모두 ssh를 무시하는 것 같습니다. 따라서 수동으로 암호를 입력해야 하는데, 이를 원하지 않을 수도 있습니다.
아래 cmds를 통해 문제가 해결됩니다.
git pull --rebase
git push
http://github.com/my_user_name/my_repo 에 가면 저장소의 git 경로를 선택할 수 있는 텍스트 상자가 나타납니다.이거 쓰실 거예요!
github.com 에 펍키를 추가했는데 성공적이었습니다.
ssh -T git@github.com
그러나 이 작업을 잘못 수행한 후 "You can't push" 오류가 발생했습니다.
git clone git://github.com/mygithubacct/dotfiles.git
git remote add origin git@github.com:mygithubacct/dotfiles.git
...edit/add/commit
git push origin master
제가 했어야 할 일을 하는 대신에:
mkdir dotfiles
cd dotfiles
git init
git remote add origin git@github.com:mygithubacct/dotfiles.git
git pull origin master
...edit/add/commit
git push origin master
설정할https대신에 전세계적으로git://:
git config --global url.https://github.com/.insteadOf git://github.com/
당신이 그것을 극복하는 가장 빠른 방법은 대체하는 것입니다.origin그것이 주는 제안으로.
대신에git push origin master, 용도:
git push git@github.com:my_user_name/my_repo.git master
언급URL : https://stackoverflow.com/questions/7548661/git-github-cant-push-to-master
'programing' 카테고리의 다른 글
| VBA를 사용하여 xls 워크북을 xlsb로 저장해야 합니다. (0) | 2023.09.12 |
|---|---|
| Express에서 사용자 지정 즐겨찾기 아이콘을 설정하는 방법은 무엇입니까? (0) | 2023.09.07 |
| Angular CLI 출력 - 번들 파일을 분석하는 방법 (0) | 2023.09.07 |
| 스크롤 이벤트에 참여하는 방법은? (0) | 2023.09.07 |
| 시퀀스를 제거하는 방법은? (0) | 2023.09.07 |