Hi,
first I'm on branch issue/224.
After pushing to the repo managed with git-subrepo I tried to update the subrepo with git subrepo push --all -v and get following output:
`* Fetch the upstream: https://someurl/UXMobile/GitTest3.git (master).
Anybody understands why this is not working?
Some basic questions first to rule out the easy solutions:
Have you tried without the --all flag?
If I just try to push GitTest3 I get the same error.
can you add the -d flag and see if that gives some more information?
This is the output from git subrepo push GitTest3 -vd
`>>> git rev-parse --verify HEAD
git fetch --quiet https://someurl/UXMobile/GitTest3.git master
- Get the upstream subrepo HEAD commit.
git rev-parse FETCH_HEAD^0- Create ref 'refs/subrepo/GitTest3/fetch'.
- Check upstream head against .gitrepo commit.
- Create subrepo branch 'subrepo-push/GitTest3'.
- Check if the 'subrepo-push/GitTest3' branch already exists.
- Get commits specific to the subdir.
git filter-branch -f --subdirectory-filter GitTest3 HEAD- Remove the .gitrepo file from the history.
git filter-branch -f --prune-empty --tree-filter rm -f .gitrepo- Create branch 'subrepo-push/GitTest3' for this new commit set.
git branch subrepo-push/GitTest3- Reset to the 'master' branch.
git reset --hard de1a754e40de7220fc48c43f19214d96e8bb8dd7
- Find ancestor with same treehash.
- source1 side: 4 commits
- target1 side: 4 commits
- Found ancestor: 26de84f418fdb97e4c21b4edbf82bbe29f83f83c,d0180761cfb3e032e2ac42c9670ac52603d0410e
- Steps from HEAD: 0
- We have found a common ancestor with refs/subrepo/GitTest3/fetch:HEAD
- Set a common ancestor.
git rebase --onto 26de84f418fdb97e4c21b4edbf82bbe29f83f83c d0180761cfb3e032e2ac42c9670ac52603d0410e subrepo-push/GitTest3
- Run 'git rebase -X theirs refs/subrepo/GitTest3/fetch subrepo-push/GitTest3'.
git rebase -X theirs refs/subrepo/GitTest3/fetch subrepo-push/GitTest3
git checkout master
- Make sure that 'subrepo-push/GitTest3' exists.
- Make sure 'subrepo-push/GitTest3' contains the 'refs/subrepo/GitTest3/fetch' HEAD.
- Push branch 'subrepo-push/GitTest3' to 'https://someurl/UXMobile/GitTest3.git' (master).
git push --force https://someurl/UXMobile/GitTest3.git subrepo-push/GitTest3:master
git-subrepo: Command failed: 'git push --force https://someurl/UXMobile/GitTest3.git subrepo-push/GitTest3:master'.`
It seems there is not more information.
What I just remembered is, that git lfs is enabled on this repo. But it doesn't look like there is the problem. But I can later check with a pure git repo if there is the same problem.
I noticed that in this version of git-subrepo we use --force to the push, this might not be allowed in all repos as it might mess up other peoples work, when you tried to push directly, did you use --force?
If not try that and see what happens.
I if push directly with --force to the repo it works as usual.
With a different subrepo in the same master repository I now get the following error:
git-subrepo: Command failed: 'git rebase --onto 81e3f3f004720c0ffe73db38a47521fa1b9db52a e20d781a647fd48388ba293f537885f50ecbcf2b_3a853c947deea7fb5fd1c5326fd22642bd4dbe51_cd9b5767c0027c4cf4287c7d5dbae7e5dcbed84f_d4295ef3421a30279017469ce39f511d9c98c170 subrepo-push/test_test'.
I freshly cloned this repository, added a file, commited and then tried to push to the subrepo.
@csteinlehner I was having a very similar issue today, I have 2FA setup on GitHub and needed to enter a Personal Access Token for password rather than my regular GH password. If you're using SSH that doesn't happen as SSH keys are always trusted.
I encountered the same problem today. I tried to run the failed command manually e.g.:
git push --force https://someurl/UXMobile/GitTest3.git subrepo-push/GitTest3:master
At this point, more verbose information came up on the failure (which was related to write permissions in my case). There should be more information printed when a subrepo command fails, especially when using the --debug option.
git version: 2.7.4
git-subrepo: 0.3.1
I just ran into this today with a (learning) test repo and found the underlying reason for the push failure.
$ mydir=$PWD
$ mkdir foo bar
$ echo foo > foo/foo.txt; echo bar > bar/bar.txt
$ cd bar; git init; git add .; git ci -m"initial commit"
$ cd foo; git init; git add .; git ci -m"initial commit"
$ git subrepo clone ../bar
$ cd bar; echo foobar > foobar.txt; git add .; git ci -m"foobar.txt"
$ cd ..
$ git subrepo push bar
*git-subrepo: Command failed: 'git push ../bar subrepo-push/bar:master'.
After thinking about the failure, it dawned on me that git won't allow me to push to a remote branch that is checked out. The error doesn't really indicate that, but this is what is happening behind the scenes.
To fix the issue:
$ cd $mydir/bar
$ git checkout -b moveBgetouttheway
$ cd ../foo
$ git branch -D subrepo-push/bar
$ git subrepo push bar
Subrepo 'bar' pushed to '../bar' (master).
Another way is to set git config receive.denyCurrentBranch false on the _bar_ repo
Hopefully this will help someone in the future. Peace
Most helpful comment
git version: 2.7.4
git-subrepo: 0.3.1
I just ran into this today with a (learning) test repo and found the underlying reason for the push failure.
After thinking about the failure, it dawned on me that git won't allow me to push to a remote branch that is checked out. The error doesn't really indicate that, but this is what is happening behind the scenes.
To fix the issue:
Another way is to set
git config receive.denyCurrentBranch falseon the _bar_ repoHopefully this will help someone in the future. Peace