我在Git中创建了一个新分支:
git branch my_branch
Run Code Online (Sandbox Code Playgroud)
推它:
git push origin my_branch
Run Code Online (Sandbox Code Playgroud)
现在说有人在服务器上做了一些更改,我想从中拉出来origin/my_branch.我做:
git pull
Run Code Online (Sandbox Code Playgroud)
但我得到:
You asked me to pull without telling me which branch you
want to merge with, and 'branch.my_branch.merge' in
your configuration file does not tell me, either. Please
specify which branch you want to use on the command line and
try again (e.g. 'git pull <repository> <refspec>').
See git-pull(1) for details.
If you often merge with the same branch, you may want to
use something like …Run Code Online (Sandbox Code Playgroud) 每当我试图推进我的repo git要求两者username & password.
我每次都重新输入密码没有问题,但问题是输入用户名.我https用来克隆我的存储库.
那么,我如何配置git以便它不会username在每个上面都要求git push.
我是linux的新手,但是Windows中的IIRC git push只要求输入密码.
我一直在使用Github上一小会儿,我一直罚款git add,git commit以及git push到目前为止,没有任何问题.突然间我有一个错误说:
致命:身份验证失败
在终端我克隆了一个存储库,处理了一个文件然后我用来git add将文件添加到提交日志中,当我这样做时git commit,它运行正常.最后,git push要求输入用户名和密码.我正确地把它们放进去,每次我这样做,它都说同样的错误.
有谁知道这个问题的原因是什么以及我如何解决它?
内容.git/config是:
[core]
repositoryformatversion = 0
filemode = true
bare = false
logallrefupdates = true
[remote "origin"]
url = http://www.github.com/######/Random-Python-Tests
fetch = +refs/heads/*:refs/remotes/origin/*
[branch "master"]
remote = origin
merge = refs/heads/master
[user]
name = #####
email = ############
Run Code Online (Sandbox Code Playgroud) 我今天最终得到了一个独立的头,同样的问题如下所述:git push说一切都是最新的,即使我有本地更改
据我所知,我没有做任何与众不同的事情,只是从我当地的回购中提交和推送.
那我怎么最终得到一个detached HEAD?
我想更改Git默认远程分支目的地,所以我可以
git push
Run Code Online (Sandbox Code Playgroud)
代替:
git push upstream
Run Code Online (Sandbox Code Playgroud)
目前这被设置为原始远程,我想将其设置为不同的远程.
我试图删除原始(克隆自)遥控器
git remote rm origin
Run Code Online (Sandbox Code Playgroud)
哪个确实删除了原来的遥控器.但并没有解决git push问题.我还是得到:
致命:没有配置推送目的地.
从命令行指定URL 或使用...配置远程存储库
我也试过玩:
git remote set-url --push myfork origin
Run Code Online (Sandbox Code Playgroud)
和其他选项,但似乎没有工作(也许是因为我太快删除了原点遥控器?)
在这里答案后,我试图改变:
git config push.default upstream (or matching)
Run Code Online (Sandbox Code Playgroud)
但都没有奏效.
我是新手git,我在练习.我创建了一个本地分支,但是当我完成时,我看到git push我的分支没有上传到存储库.我必须这样做:git push -u origin --all.
为什么是这样?不是分支是默认推送的新变化吗?为什么我需要运行第二个命令?
我已经安装了gitolite(现在是本地的,用于实验),它似乎有效,除了新的存储库在git clone之后没有默认跟踪远程.如果我没记错的话,当我从github.com克隆一个存储库时,它已经能够推送.
这是我尝试过的:
$ git clone git@localhost:sandbox
Cloning into sandbox...
warning: You appear to have cloned an empty repository.
$ echo "A" > README
$ git add README
$ git commit README -m 'test'
$ git push
No refs in common and none specified; doing nothing.
Perhaps you should specify a branch such as 'master'.
fatal: The remote end hung up unexpectedly
error: failed to push some refs to 'git@localhost:sandbox'
Run Code Online (Sandbox Code Playgroud)
当我尝试明确推送一切正常时:
$ git push origin master
Counting objects: 6, done. …Run Code Online (Sandbox Code Playgroud) 每当我尝试使用Pycharm在GitHub中推送存储库时,它就会失败.
Push failed: fatal: Authentication failed for 'https://github.com/(my github repository)/'
Run Code Online (Sandbox Code Playgroud)
在Settings-> Version Control-> GitHub中,我填写了Host,Loging和Password(Auth Type:Password)字段.测试它:"连接成功"
在Settings-> Version Control-> Git中,路径到Git可执行文件使用完整路径,SSH可执行文件:Buil-in
Pycharm版本3.1.1 Git版本1.8.4.msysgit.0在Win 7上.
我对分支进行了三次提交,并将它们分别推送到远程。然后,我需要压缩提交,因此我使用了:
git reset --soft HEAD~3 && git commit
git push --force
Run Code Online (Sandbox Code Playgroud)
在第二行,我遇到一个致命错误:
The current branch [BRANCH-NAME] has no upstream branch.
To push the current branch and set the remote as upstream.
Run Code Online (Sandbox Code Playgroud)
我使用尝试了它的建议命令git push --set-upstream origin [BRANCH-NAME],但被告知当前分支的尖端在其远程对应的后面。回顾过去,这很有意义,因为我当前在本地分支的索引1上,而头部在远程的索引3上。
我现在要做的基本上是将分支的压缩版本(我在本地拥有)替换远程的非压缩版本。这里正确的方法是什么?
我已经看过这个,还有其他几个,但他们没有帮助。
git ×9
github ×4
git-branch ×1
git-push ×1
git-rebase ×1
git-remote ×1
gitolite ×1
linux ×1
pycharm ×1
rebase ×1
windows ×1