我有一个我正在处理的本地存储库,它的远程服务器托管在GitHub上.我最近创建了一个分支并开始研究它,进行了几次提交,现在希望将分支推送到GitHub并能够将其拉到另一个克隆的存储库.
要做到这一点需要做些什么?
如果使用GitHub无法做到这一点,我很乐意知道如何正常使用它.
有没有在推动本地git仓库的主分支被称为起源与远程存储库的主分支有什么区别git push origin master
或git push origin?
我经常修改功能分支,然后强制将它们推送到服务器.
git push --force origin feature-mongodb-support
Run Code Online (Sandbox Code Playgroud)
有没有捷径git push --force origin <current branch>?
我有一个Git存储库.我克隆了存储库,可以提交我的本地更改.当我将更改推送到服务器时,它可以工作.
一旦我创建了一个分支,我就会检查分支,提交我的工作,然后检查主分支.然后我将我的本地更改合并到主分支中.当我尝试推送到服务器时,我得到以下异常:
Welcome to Git (version 1.7.11-preview20120620)
Run 'git help git' to display the help index.
Run 'git help <command>' to display help for specific commands.
$ git push origin master:master
Counting objects: 9, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (7/7), done.
Writing objects: 100% (8/8), 13.68 KiB, done.
Total 8 (delta 2), reused 1 (delta 0)
Unpacking objects: 100% (8/8), done.
remote: error: refusing to update checked out branch: refs/heads/master
remote: error: By default, …Run Code Online (Sandbox Code Playgroud) 通常,我只是跑
git add file
git commit
git push
Run Code Online (Sandbox Code Playgroud)
但如果我在推送之前修改了提交(with git commit --amend),则下一次推送失败
hint: Updates were rejected because the tip of your current branch is behind
hint: its remote counterpart. Integrate the remote changes (e.g.
hint: 'git pull ...') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.
Run Code Online (Sandbox Code Playgroud)
如何让git在不合并分支的情况下推送更改?我只有一个分支(master),我是唯一一个使用这个回购的人,为什么这么说呢?
git branch -a:
* master
remotes/origin/HEAD -> origin/master
remotes/origin/master
Run Code Online (Sandbox Code Playgroud)
编辑:使用gitk HEAD @{u},我看到我有2个分支,一个用原始提交,另一个用修改提交.
如果我在一个功能的多个分支上工作,我git pull branch1 branch2 branch3会将所有更改提取到我的主分支中.但是,也会复制每个分支的所有提交日志.如何将提交日志压缩为单个消息?
我是git的新手.我想将一个大型提交推送到远程服务器,但问题是我何时使用
git push origin master
Run Code Online (Sandbox Code Playgroud)
它返回错误
Counting objects: 5009, done.
Delta compression using up to 16 threads.
fatal: unable to create thread: Resource temporarily unavailable
error: pack-objects died with strange error
Run Code Online (Sandbox Code Playgroud)
那么无论如何我可以设置Delta Compression的最大线程使用.
感谢帮助,
袁晨
我有一个在git.debian.org(alioth)上托管的项目,我想在http://gitorious.org上配置一个post-receive钩子来更新存储库的镜像.
我想我必须要用 git push --mirror gitorious
现在,我需要让Alioth获得授权才能获得成功.我怎么做?
我想我需要在gitorious上配置用户并为其创建一个ssh密钥.然后当我在post-receive钩子中执行git push时,请确保使用此ssh键.
我可以使用~/.ssh/config但问题是许多用户可以推送aloth,每个人都必须登录并配置~/.ssh/config.相反,我想要一个命令行选项或环境变量来告诉ssh使用哪个键.我能这样做吗?
另外,您是否有其他想法可以实现镜像?并且,是否有可能以相反的方式配置它(有效推动阿里斯)?
我正在试图找出一种防止开发人员用Git推动大师的好方法.我们使用GitHub来托管我们的远程存储库,因此pre-receive钩子不是一个选项.是否可以为开发人员团队轻松实施任何其他解决方案?
作为旁注,我一般不想禁用推力.有时它是必要的邪恶.但是说,推动大师的力量不可能发生.
有时候,尤其是 当我是唯一一个在远程存储库上工作的人时,我喜欢用git rebase -i和重写历史git push origin master -f.
如何在git pull origin master没有合并的情况下强制执行?我尝试了-f选项,但是没有用.我只想重写我本地git仓库的历史记录以匹配远程(原点)的历史记录.
git ×10
git-push ×10
git-pull ×3
github ×2
branch ×1
git-alias ×1
git-amend ×1
git-commit ×1
git-config ×1
git-fetch ×1
git-merge ×1
git-remote ×1
gitorious ×1
hook ×1
mirroring ×1