1

I have an server (available via ssh) on the internet that my friend and I use for working on projects together. We have started using git for source control. Our setup currently is as follows:

  • Friend created repository on server with git --bare init named project.friend.git
  • I cloned project.friend.git on server to project.jesse.git
  • I then cloned project.jesse.git on server to my local machine using git clone jesse@server:/git_repos/project.jesse.git
  • I work on my local machine and commit to the local machine. When I want to push my changes to the project.jesse.git on server I use git push origin master. My friend is working on project.friend.git. When I want to get his changes I do pull jesse@server:/git_repos/project.friend.git.

Everything seems to be working fine, however, I am now getting the following error when I do 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

Is this warning anything I need to be worried about? Like I said, everything seems to be working. My friend is able to pull my changes in from my branch. I have the clone on the server so he can access it since he does not have access to my local machine. Is there something that could be done better?

Thanks!

4

1 に答える 1

4

サーバー上に裸のリポジトリを設定する必要があります。ベア リポジトリには、通常は.gitリポジトリ ルートのディレクトリにあるバージョン履歴情報のみが含まれます。他のリポジトリと同様に、そこからクローンを作成したり、プッシュしたりできます。

ベアリポジトリはで作成されます

 git init --bare

すでにいくつかのバージョン履歴がある場合は、裸のクローンを作成します

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

警告については、この質問を参照してください。

于 2010-04-30T03:44:39.057 に答える