Question

J'ai un serveur (disponible via SSH) sur Internet que mon ami et moi utilisons pour travailler ensemble sur des projets. Nous avons commencé à utiliser GIT pour le contrôle de la source. Notre configuration est actuellement la suivante:

  • Ami a créé le référentiel sur server avec git --bare init nommé project.friend.git
  • J'ai cloné project.friend.git sur server à project.jesse.git
  • J'ai ensuite cloné project.jesse.git sur server à ma machine locale en utilisant git clone jesse@server:/git_repos/project.jesse.git
  • Je travaille sur ma machine locale et je m'engage dans la machine locale. Quand je veux pousser mes modifications au project.jesse.git sur server j'utilise git push origin master. Mon ami travaille sur project.friend.git. Quand je veux obtenir ses modifications, je fais pull jesse@server:/git_repos/project.friend.git.

Tout semble bien fonctionner, cependant, j'obtiens maintenant l'erreur suivante quand je fais git push origin master:

localpc:project.jesse jesse$ git push origin master
Counting objects: 100, done.
Delta compression using up to 2 threads.
Compressing objects: 100% (76/76), done.
Writing objects: 100% (76/76), 15.98 KiB, done.
Total 76 (delta 50), reused 0 (delta 0)
warning: updating the current branch
warning: Updating the currently checked out branch may cause confusion,
warning: as the index and work tree do not reflect changes that are in HEAD.
warning: As a result, you may see the changes you just pushed into it
warning: reverted when you run 'git diff' over there, and you may want
warning: to run 'git reset --hard' before starting to work to recover.
warning: 
warning: You can set 'receive.denyCurrentBranch' configuration variable to
warning: 'refuse' in the remote repository to forbid pushing into its
warning: current branch.
warning: To allow pushing into the current branch, you can set it to 'ignore';
warning: but this is not recommended unless you arranged to update its work
warning: tree to match what you pushed in some other way.
warning: 
warning: To squelch this message, you can set it to 'warn'.
warning: 
warning: Note that the default will change in a future version of git
warning: to refuse updating the current branch unless you have the
warning: configuration variable set to either 'ignore' or 'warn'.
To jesse@server:/git_repos/project.jesse.git
   c455cb7..e9ec677  master -> master

Cet avertissement est-il quelque chose dont je dois m'inquiéter? Comme je l'ai dit, tout semble fonctionner. Mon ami est capable de tirer mes changements de ma branche. J'ai le clone sur le serveur afin qu'il puisse y accéder car il n'a pas accès à ma machine locale. Y a-t-il quelque chose qui pourrait être fait mieux?

Merci!

Était-ce utile?

La solution

Vous devriez configurer un nu Référentiel sur le serveur. Un référentiel nu ne contient que les informations d'historique de version qui se trouvent généralement dans le .git Répertoire dans votre racine de référentiel. Vous pouvez vous le cloner ou le pousser comme avec tout autre référentiel.

Les référentiels nus sont créés avec

 git init --bare

Si vous avez déjà l'historique de la version, faites un clone nu

git clone --bare git://some/where

Quant à votre avertissement voir cette question.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top