本文介绍了无法将Git推送到Github的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 29岁程序员,3月因学历无情被辞! 这个问题与我在理解中的问题有关rebase,branch和merge ,和问题我发现其他人也有同样的问题。 这个问题似乎与/etc/xinet.d/有关。 问题:无法推送我的本地分支到我在Github的主分支 我运行 git push origin master 我得到 fatal:'origin'似乎不是git仓库 fatal:远程端意外挂起 错误消息提示我分支的origin不在我的本地git仓库中。这样,Git就会停止连接到Github。 这很奇怪,因为我没有删除分支的原点。 我的git树是 dev * master ticgit 遥控器/数学/数学遥控器/数学/大师遥控器/原点/主控器遥控器/马西师傅/硕士 当您在本地Git中拥有teamMate分支时,如何将本地分支推送到Github ? VonC的答案解决了主要问题。 我给我的ssh密钥加了一个passphares。 我运行 $ git push github master 我得到 权限被拒绝(publickey)。 致命:远程端意外挂起 看起来我需要给密码对于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 (我实际上使用名称'github'而不是'origin'或'origin2') 检查您的gitHub身份是否在您的本地Git存储库中正确声明,如 GitHub帮助指南。 (包括user.name和github.name - 以及github.token) 然后, stonean blog 建议(与 Marcio Garcia ): $ cd〜/ .ssh $ ssh-add id_rsa Aral Balkan 补充道:创建配置文件 主机github.com 用户git 端口22 主机名github.com IdentityFile〜/ .ssh / id_rsa T CPKeepAlive是 IdentitiesOnly是 您也可以发布 $ b的结果 $ b ssh -v git@github.com 以获得更多关于为什么GitHub ssh连接拒绝您的信息。 检查您是否输入了正确的公钥(它需要以' code> == ')。 不要粘贴您的私钥,而要粘贴您的私钥。公钥将如下所示: ssh-rsa AAAAB3<这里的大字符串> == tek ... @ gmail。 (注意:你是否为你的密钥使用了密码短语?如果没有密码短语,它会更容易一些。 ) 检查推送时使用的网址( git@github.com /...,而不是 git://github.com / ... ) 检查您是否有SSH代理以使用和缓存 试试这个: $ ssh -i路径/ to / public / key git@github.com 如果这有效,那么这意味着您的密钥是没有被你的SSH客户端发送到GitHub。 This question is related to my problem in understanding rebase, branch and merge,and to the problemI found out that other people have had the same problem.The problem seems to be related to /etc/xinet.d/.Problem: unable to push my local branch to my master branch at GithubI rungit push origin masterI get fatal: 'origin' does not appear to be a git repositoryfatal: The remote end hung up unexpectedlyThe error message suggests me that the branch 'origin' is not in my local git repository. This way, Git stops connecting to Github.This is strange, since I have not removed the branch 'origin'.My git tree is dev* master ticgit remotes/Math/Math remotes/Math/master remotes/origin/master remotes/Masi/masterHow can you push your local branch to Github, while you have a teamMate's branch in your local Git?VonC's answer solves the main problem.I put a passphares to my ssh keys.I run $git push github masterI getPermission denied (publickey).fatal: The remote end hung up unexpectedlyIt seems that I need to give the passphrase for Git somehow.How can you make Github ask for your passphrase rather than relying on the ssh key? 解决方案 What does$ git config --get-regexp '^(remote|branch)\.'returns (executed within your git repository) ?Origin is just a default naming convention for referring to a remote Git repository.If it does not refer to GitHub (but rather a path to your teammate repository, path which may no longer be valid or available), just add another origin, like in this Bloggitation entry$ git remote add origin2 git@github.com:myLogin/myProject.git$ git push origin2 master(I would actually use the name 'github' rather than 'origin' or 'origin2')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_rsaAral Balkan adds: create a config fileHost github.comUser gitPort 22Hostname github.comIdentityFile ~/.ssh/id_rsaTCPKeepAlive yesIdentitiesOnly yesYou can also post the result ofssh -v git@github.comto 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.comIf that works, then it means your key is not being sent to GitHub by your ssh client. 这篇关于无法将Git推送到Github的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 上岸,阿里云!