标签: git-push

为什么"git push"被拒绝了?("git pull"没有帮助)

我目前的分支是my_branch.我试图将更改推送到远程仓库:

$ git push
Counting objects: 544, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (465/465), done.
Writing objects: 100% (533/533), 2.04 MiB | 1.16 MiB/s, done.
Total 533 (delta 407), reused 0 (delta 0)
To git@......git
   4ed90a6..52673f3  my_branch -> my_branch
 ! [rejected]        master -> master (non-fast-forward)
error: failed to push some refs to 'git@......git'
To prevent you from losing history, non-fast-forward updates were rejected
Merge the remote changes (e.g. 'git pull') before pushing again. …
Run Code Online (Sandbox Code Playgroud)

git git-push

16
推荐指数
2
解决办法
7万
查看次数

"git push"会推送其他分支的所有提交吗?

如果我在本地仓库中的许多分支中有许多未提交的提交,如果我输入会发生什么git push?是所有这些提交都会被推送还是只有属于当前分支的提交?

git git-push

16
推荐指数
2
解决办法
1万
查看次数

克隆包含所有子模块的git仓库

我有一个工作的git存储库,包含几个子模块(通过克隆不同的存储库获得).

现在,我想通过推送或克隆将整个存储库(包含所有子模块)复制到另一台机器上的裸git 存储库中.我很好地丢失了子模块的历史(我只是想保留它们的内容).

这可能吗 ?在我的尝试中,在克隆的存储库中子模块目录为空.

PS我知道这不是正确的工作流程(请参阅创建带子模块的公共存储库),但是不可能更新原始子模块.

git git-push git-clone git-submodules

16
推荐指数
1
解决办法
9809
查看次数

使用Xcode 9推送标签

从cli我推这样的标签

git tag 1.0.1 && git push origin 1.0.1
Run Code Online (Sandbox Code Playgroud)

从Xcode 9我可以标记提交.但是,如何将该标记从Xcode推送到源?

git xcode git-push git-tag xcode9-beta

16
推荐指数
1
解决办法
1147
查看次数

git:如何指定默认的远程push-to分支?

假设我有一个名为' abc' 的跟踪分支跟踪origin/master.

当我在' abc'并且做一个时git push,它会abc' 推' ' abc'.
如何使用' git push' 指定远程推送分支?

git git-push remote-branch

15
推荐指数
1
解决办法
1万
查看次数

配置本地分支以推送到特定分支

对不起,如果已经提出这个问题了.

我从一个名为"git_lab"的repo克隆,它有一个名为"test"的分支.克隆时我使用"-b myname_test"创建一个名为"myname_test"的本地分支,本地克隆名为"myname_git_lab"

当我执行"git pull"时,它会自动获取并合并从"test"到"myname_test"的更改,但是对于git push,我需要指定repo和branch名称.

$> git remote show git_lab

为'git pull'配置的本地分支:myname_test与远程测试合并

有没有办法我可以配置"为'git push'配置的本地分支",这样我就不需要指定分支和repo名称?

git git-push remote-branch git-config git-branch

15
推荐指数
1
解决办法
2万
查看次数

为什么我们需要在git pull之前首先进行git推送?

我有本地更改和远程更改.

有人告诉我,我必须先推,然后拉.这有什么原因吗?

git git-pull git-push

15
推荐指数
1
解决办法
8995
查看次数

为什么git不允许我删除远程分支

我有一个本地存储库,我想镜像到远程'websrv'.这曾经工作正常,直到我删除了一个本地分支.现在当我这样做

git push --mirror websrv
Run Code Online (Sandbox Code Playgroud)

我明白了

remote: error: By default, deleting the current branch is denied, because the next
remote: error: 'git clone' won't result in any file checked out, causing confusion.
remote: error: 
remote: error: You can set 'receive.denyDeleteCurrent' configuration variable to
remote: error: 'warn' or 'ignore' in the remote repository to allow deleting the
remote: error: current branch, with or without a warning message.
remote: error: 
remote: error: To squelch this message, you can set it to 'refuse'. …
Run Code Online (Sandbox Code Playgroud)

git git-push

15
推荐指数
1
解决办法
1万
查看次数

推送到Git返回错误代码403致命

我想将README.md推送到Github.
使用Ubuntu 14.04LTS
所以,我提交以下步骤.

echo "# test" >> README.md
git init
git add README.md
git commit -m "first commit"
git remote add origin https://github.com/user/repo.git
git push -u origin master
Run Code Online (Sandbox Code Playgroud)

但是,发生以下错误.

error: The requested URL returned error: 403 Forbidden while accessing https://github.com/user/repo.git/info/refs

fatal: HTTP request failed
Run Code Online (Sandbox Code Playgroud)

我知道这样解决这个错误

git remote set-url origin https://username@github.com/user/repo.git
Run Code Online (Sandbox Code Playgroud)

这样,我必须输入密码.

$ git push origin master
Password: 
Run Code Online (Sandbox Code Playgroud)

但我不想输入密码.

我检查了这个,但我没有解决.
推送到Git返回错误代码403致命:HTTP请求失败

请告诉我如何在没有密码的情况下推送.

git github git-push

15
推荐指数
2
解决办法
6万
查看次数

如何在推前拉力

每次我想推送我的提交(git commit -m "message",git push origin <branch>),我都会拉(git pull origin <branch>).
有没有办法让git在执行推送之前做一下拉?(在同一个分支上)

git git-pull git-push

15
推荐指数
3
解决办法
4082
查看次数