簡體   English   中英

使用git將存儲庫存儲在/ opt /中供所有用戶使用?

[英]Using git to store repository in /opt/ for all users?

我在同一台Linux機器上有多個用戶,幾個人都在該機器上遠程工作,並且我們正在開發一個軟件項目。

如何將主存儲庫保存在/ opt(例如/ opt / GitRepo / project)中,並讓其他所有人在其本地/ home / user目錄中擁有一個品牌?

我嘗試克隆目錄,但是在嘗試推回更改時出現錯誤:

cd /home/user1/localGit/    
git clone /opt/GitRepo/project

在我對該本地副本進行更改並嘗試執行git push

Compressing objects: 100% (3/3), done.
Writing objects: 100% (3/3), 299 bytes | 0 bytes/s, done.
Total 3 (delta 2), reused 0 (delta 0)
remote: error: refusing to update checked out branch: refs/heads/master
remote: error: By default, updating the current branch in a non-bare repository
remote: error: is denied, because it will make the index and work tree inconsistent
remote: error: with what you pushed, and will require 'git reset --hard' to match
remote: error: the work tree to HEAD.
remote: error: 
remote: error: You can set 'receive.denyCurrentBranch' configuration variable to
remote: error: 'ignore' or 'warn' in the remote repository to allow pushing into
remote: error: its current branch; however, this is not recommended unless you
remote: error: arranged to update its work tree to match what you pushed in some
remote: error: other way.
remote: error: 
remote: error: To squelch this message and still keep the default behaviour, set
remote: error: 'receive.denyCurrentBranch' configuration variable to 'refuse'.
To /opt/GitRepos/project/
 ! [remote rejected] master -> master (branch is currently checked out)
error: failed to push some refs to '/opt/GitRepos/project/

/opt/GitRepo/project的共享存儲庫應為“裸”存儲庫。 從本質上講,這意味着它僅包含您通常在.git目錄中發現的內容,並且沒有工作樹; 請參閱此處進行討論。

您可以這樣創建一個裸克隆:

git clone --bare <address> <target>

或初始化一個空的裸倉庫:

git init --bare

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM