programing tip

마스터를 Github에 Git-push 할 수 없음- 'origin'이 git 저장소로 표시되지 않음 / 권한 거부 됨

itbloger 2020. 9. 22. 07:45
반응형

마스터를 Github에 Git-push 할 수 없음- 'origin'이 git 저장소로 표시되지 않음 / 권한 거부 됨


이 질문은 rebase, branch 및 merge 이해대한 내 문제 문제와 관련 이 있습니다.

원격 목록에 teamMate가있을 때 github 계정에 어떻게 커밋 할 수 있습니까?

다른 사람들 도 같은 문제를 겪고 있다는 것을 알게되었습니다 . 문제는 /etc/xinet.d/와 관련된 것 같습니다.

문제 : 내 로컬 브랜치를 Github의 마스터 브랜치로 푸시 할 수 없습니다 .

난 달린다

git push origin master

나는 얻다

fatal: 'origin' does not appear to be a git repository
fatal: The remote end hung up unexpectedly

오류 메시지는 'origin'브랜치가 내 로컬 git 저장소에 없다는 것을 암시합니다. 이렇게하면 Git은 Github에 대한 연결을 중지합니다.

나는 분기 '원점'을 제거하지 않았기 때문에 이상합니다.

내 자식 트리는

  dev
* master
  ticgit
  remotes/Math/Math
  remotes/Math/master
  remotes/origin/master
  remotes/Masi/master

로컬 Git에 teamMate의 브랜치를 가지고있는 동안 어떻게 로컬 브랜치를 Github로 푸시 할 수 있습니까?


VonC의 답변은 주요 문제를 해결합니다. 내 ssh 키에 암호를 넣었습니다.

난 달린다

$git push github master     

나는 얻다

Permission denied (publickey).
fatal: The remote end hung up unexpectedly

어떻게 든 Git에 대한 암호를 제공해야하는 것 같습니다.

Github에서 ssh 키에 의존하지 않고 암호를 요청하도록하려면 어떻게해야합니까?


무엇을

$ git config --get-regexp '^(remote|branch)\.'

(git 저장소 내에서 실행 됨)?

Origin은 원격 Git 저장소를 참조하기위한 기본 명명 규칙 일뿐입니다.

GitHub를 참조하지 않는 경우 (그러나 팀원 저장소 경로, 더 이상 유효하지 않거나 사용 가능하지 않을 수있는 경로),이 Bloggitation 항목 과 같이 다른 출처를 추가 하십시오.

$ git remote add origin2 git@github.com:myLogin/myProject.git
$ git push origin2 master

(실제로 'origin'또는 'origin2'가 아닌 'github'라는 이름을 사용합니다.)


Permission denied (publickey).
fatal: The remote end hung up unexpectedly

Check if your gitHub identity is correctly declared in your local Git repository, as mentioned in the GitHub Help guide. (both user.name and github.name -- and github.token)

Then, stonean blog suggests (as does Marcio Garcia):

$ cd ~/.ssh
$ ssh-add id_rsa

Aral Balkan adds: create a config file

The solution was to create a config file under ~/.ssh/ as outlined at the bottom of the OS X section of this page.

Here's the file I added, as per the instructions on the page, and my pushes started working again:

Host github.com
User git
Port 22
Hostname github.com
IdentityFile ~/.ssh/id_rsa
TCPKeepAlive yes
IdentitiesOnly yes

You can also post the result of

ssh -v git@github.com

to have more information as to why GitHub ssh connection rejects you.

Check also you did enter correctly your public key (it needs to end with '==').
Do not paste your private key, but your public one. A public key would look something like:

ssh-rsa AAAAB3<big string here>== tek...@gmail.com 

(Note: did you use a passphrase for your ssh keys ? It would be easier without a passphrase)

Check also the url used when pushing (git@github.com/..., not git://github.com/...)

Check that you do have a SSH Agent to use and cache your key.

Try this:

 $ ssh -i path/to/public/key git@github.com

If that works, then it means your key is not being sent to GitHub by your ssh client.


This is a problem with your remote. When you do git push origin master, origin is the remote and master is the branch you're pushing.

When you do this:

git remote

I bet the list does not include origin. To re-add the origin remote:

git remote add origin git@github.com:your_github_username/your_github_app.git

Or, if it exists but is formatted incorrectly:

git remote rm origin
git remote add origin git@github.com:your_github_username/your_github_app.git

VonC's answer is best, but the part that worked for me was super simple and is kind of buried among a lot of other possible answers. If you are like me, you ran into this issue while running a "getting started with rails" tutorial and you had NOT setup your public/private SSH keys.

If so, try this:

  1. $>cd ~/.ssh

  2. $>ls

  3. If the output of ls is known_hosts and nothing else, visit: http://help.github.com/mac-key-setup/ and start following the instructions from the "Generating a key" section and down.

After running those instructions, my "git push origin master" command worked.


I have the same problem and i think the firewall is blocking the git protocol. So in the end I have to resort to using https:// to fetch and push. However this will always prompt the user to enter the password...

here is the example what working for me (just to share with those cant use git:// protocol :)

git fetch https://[user-name]@github.com/[user-name]/[project].git

if the above works, you can remove the origin and replace with

git remote rm origin  
git remote add origin https://[user-name]@github.com/[user-name]/[project].git

I think that's another case of git error messages being misleading. Usually when I've seen that error it's due to ssh problems. Did you add your public ssh key to your github account?

Edit: Also, the xinet.d forum post is referring to running the git-daemon as a service so that people could pull from your system. It's not necessary to run git-daemon to push to github.


I got the same problem and I just added the content of ~/.ssh/id_rsa.pub to my account in GitHub. After that just try again git push origin master, it should work.


They key thing to remember is 'origin' is not the value you may need to be using... it worked for me when I replaced 'origin' with repo's name.


One possibility that the above answers don't address is that you may not have an ssh access from your shell. That is, you may be in a network (some college networks do this) where ssh service is blocked.In that case you will not only be able to get github services but also any other ssh services. You can test if this is the problem by trying to use any other ssh service.This was the case with me.


I had this problem and tried various solutions to solve it including many of those listed above (config file, debug ssh etc). In the end, I resolved it by including the -u switch in the git push, per the github instructions when creating a new repository onsite - Github new Repository

참고URL : https://stackoverflow.com/questions/922210/unable-to-git-push-master-to-github-origin-does-not-appear-to-be-a-git-repos

반응형