В качестве ответа на мой вопрос о недоступных ветвях после миграции svn в git , у меня другая проблема: я не могу отправить новые ветки в мой центральный репозиторий Git.
$ git clone ssh://server/opt/git/our_app.git
$ cd our_app
$ git branch my-test-branch
$ git checkout my-test-branch
$ echo test > test.txt
$ git add test.txt
$ git commit test.txt -m "test commit"
[master ed81ec0] test commit
1 files changed, 1 insertions(+), 0 deletions(-)
create mode 100644 test.txt
$ git push
Everything up-to-date
Итак, это не подталкивает мою ветку к серверу.Коллега посоветовал мне заглянуть в мой .git / config, который выглядит следующим образом:
[core]
repositoryformatversion = 0
filemode = true
bare = false
logallrefupdates = true
ignorecase = true
[remote "origin"]
fetch = +refs/heads/*:refs/remotes/origin/*
url = ssh://server/opt/git/our_app.git
[branch "master"]
remote = origin
merge = refs/heads/master
Мне посоветовали вручную добавить push-запись:
[remote "origin"]
fetch = +refs/heads/*:refs/remotes/origin/*
url = ssh://server/opt/git/our_app.git
push = refs/heads/*:refs/heads/*
Теперь все выглядит лучше:
$ git push
Password:
Counting objects: 1, done.
Delta compression using up to 1 threads.
Compressing objects: 100% (1/1), done.
Writing objects: 100% (1/1), 5 bytes, done.
Total 1 (delta 1), reused 0 (delta 0)
To ssh://server/opt/git/our_app.git
* [new branch] my-test-branch -> my-test-branch
Хотя это сработало, оно все равно похоже на взлом.Как правильно это сделать?