Apr
27
Posted on 27-04-2010
Filed Under (git, linux) by Leandro Nunes on 27-04-2010

Se você atualizou a sua versão do git para a 1.6.3.3 como eu vai ficar assustado depois de dar um git push.

Você vai se deparar com isso:

warning: You did not specify any refspecs to push, and the current remote
warning: has not configured any push refspecs. The default action in this
warning: case is to push all matching refspecs, that is, all branches
warning: that exist both locally and remotely will be updated.  This may
warning: not necessarily be what you want to happen.
warning:
warning: You can specify what action you want to take in this case, and
warning: avoid seeing this message again, by configuring 'push.default' to:
warning:   'nothing'  : Do not push anything
warning:   'matching' : Push all matching branches (default)
warning:   'tracking' : Push the current branch to whatever it is tracking
warning:   'current'  : Push the current branch

Pode ficar tranquilo que não foi uma falha de segmentação no seu SO, mas sim uma mensagem de Warning que o novo git trás para te avisar que você precisa configurar a variável:

push.default

É claro que o seu comando vai continuar funcionando perfeitamente como sempre funcionou se você não configurar essa variável, mas você vai ficar agoniado com essa mensagem imensa de warning aparecendo toda hora na sua tela.

Acredite em mim :)

Então para ajeitar isso basta configurar variável com o comando:

git config push.default matching

Se você deseja que esta seja uma configuração padrão para todos os seus repositórios digite o comando:

git config --global push.default matching
May
28
Posted on 28-05-2009
Filed Under (git) by Leandro Nunes on 28-05-2009

Eu utilizo o gitosis para gerenciar os meus repositórios git e dei os meus primeiros passos para configurá-lo da forma correta seguido o tutorial hosting-git-repositories-the-easy-and-secure-way.

Antigamente ao adicionar um repositório novo eu tinha um problema.

Eu seguia todos os passos descritos no tutorial para adicionar um novo repositório, e ao dar um pull eu recebia a seguinte mensagem de erro:


smurf@smurf:~/safernet/projetos/snscripts$ git pull
You asked me to pull without telling me which branch you
want to merge with, and 'branch.master.merge' in
your configuration file does not tell me either. Please
name which branch you want to merge on the command line and
try again (e.g. 'git pull ').
See git-pull(1) for details on the refspec.

If you often merge with the same branch, you may want to
configure the following variables in your configuration
file:

branch.master.remote =
branch.master.merge =
remote..url =
remote..fetch =

Abrindo o arquivo de configuração do git (.git/config) eu notei que não existiam as informações do branch master que eu estava trabalhando no momento.

[core]
repositoryformatversion = 0
filemode = true
bare = false
logallrefupdates = true
[remote "origin"]
url = git@host.com.br:project_name.git
fetch = +refs/heads/*:refs/remotes/origin/*

Então eu editei o arquivo .git/config adicionando as informações do branch master:


[core]
repositoryformatversion = 0
filemode = true
bare = false
logallrefupdates = true
[remote "origin"]
url = git@host.com.br:project_name.git
fetch = +refs/heads/*:refs/remotes/origin/*
[branch "master"]
remote = origin
merge = refs/heads/master

Pronto.

Agora será possível dar um pull normalmente.


smurf@smurf:~/safernet/projetos/snscripts$ git pull
Already up-to-date.

Não sei se esta é a melhor forma de resolver o problema, mas é a que eu utilizo.

Espero que seja útil para alguém ;)

eXTReMe Tracker