GitHub como flujo de trabajo en el servidor privado a través de SSH
-
02-10-2019 - |
Pregunta
Tengo un servidor (disponible a través de SSH) en Internet que mi amigo y yo usamos para trabajar juntos en proyectos. Hemos comenzado a usar GIT para el control de origen. Nuestra configuración actualmente es la siguiente:
- Amigo creado repositorio en
server
congit --bare init
nombradaproject.friend.git
- Cloné
project.friend.git
enserver
aproject.jesse.git
- Luego cloné
project.jesse.git
enserver
a mi máquina local usandogit clone jesse@server:/git_repos/project.jesse.git
- Trabajo en mi máquina local y me comprometo con la máquina local. Cuando quiero empujar mis cambios al
project.jesse.git
enserver
yo suelogit push origin master
. Mi amigo esta trabajandoproject.friend.git
. Cuando quiero obtener sus cambios, hagopull jesse@server:/git_repos/project.friend.git
.
Todo parece estar funcionando bien, sin embargo, ahora recibo el siguiente error cuando lo hago 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
¿Es esta advertencia algo que necesito preocuparse? Como dije, todo parece estar funcionando. Mi amigo puede sacar mis cambios de mi rama. Tengo el clon en el servidor para que pueda acceder a él ya que no tiene acceso a mi máquina local. ¿Hay algo que se pueda hacer mejor?
¡Gracias!
Solución
Deberías configurar un desnudo repositorio en el servidor. Un repositorio desnudo contiene solo la información del historial de versiones que generalmente se encuentra en el .git
directorio en su repositorio raíz. Puede clonar desde él o presionarlo como con cualquier otro repositorio.
Los repositorios desnudos se crean con
git init --bare
Si ya tiene algún historial de versiones, haga un clon desnudo
git clone --bare git://some/where
En cuanto a su advertencia, ver esta pregunta.