سؤال

لدي خادم (متاح عبر SSH) على الإنترنت الذي أستخدمه أنا وصديقي للعمل في المشاريع معًا. لقد بدأنا استخدام GIT للتحكم في المصدر. الإعداد لدينا حاليا كما يلي:

  • ابتكر الصديق مستودعًا server مع git --bare init اسم الشيئ project.friend.git
  • استنسخ project.friend.git على server إلى project.jesse.git
  • ثم استنسخ project.jesse.git على server إلى الجهازي المحلي باستخدام git clone jesse@server:/git_repos/project.jesse.git
  • أنا أعمل على الجهازي المحلي وألتزم بالآلة المحلية. عندما أرغب في دفع تغييراتي إلى project.jesse.git على server أنا أستعمل git push origin master. صديقي يعمل على project.friend.git. عندما أرغب في الحصول على تغييراته أفعل pull jesse@server:/git_repos/project.friend.git.

يبدو أن كل شيء يعمل بشكل جيد ، ومع ذلك ، أحصل الآن على الخطأ التالي عندما أفعل 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

هل هذا التحذير أي شيء أحتاج إلى قلقه؟ كما قلت ، يبدو أن كل شيء يعمل. صديقي قادر على سحب التغييرات الخاصة بي من فرعتي. لديّ استنساخ على الخادم حتى يتمكن من الوصول إليه لأنه لا يستطيع الوصول إلى الجهاز المحلي الخاص بي. هل هناك شيء يمكن القيام به بشكل أفضل؟

شكرًا!

هل كانت مفيدة؟

المحلول

يجب عليك إعداد ملف عارية مستودع على الخادم. يحتوي مستودع عاري فقط على معلومات تاريخ الإصدار التي عادة ما تكون في .git دليل في جذر المستودع الخاص بك. يمكنك استنساخ منه أو الضغط عليه كما هو الحال مع أي مستودع آخر.

يتم إنشاء المستودعات العارية مع

 git init --bare

إذا كان لديك بالفعل بعض سجل الإصدار ، قم بعمل استنساخ عاري

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

أما التحذير الخاص بك انظر هذا السؤال.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top