Reputation: 41
I'm new to git and would like to build a git database for my team. I tried these steps:
mkdir test
cd test
git init
git remote add short_name /prj/my_prj/item1.git
to my understanding, the /prj/my_prj/item1.git
should be an open repository to all memebers of my team. I then tried to add the database as:
cp from_some_database/my_files .
git add my_files
git commit -m "initial checkin"
git push short_name
here i got error as:
fatal: `/prj/my_prj/item1.git` does not appear to be a git repository
can anybody give me some help? thanks.
Upvotes: 1
Views: 58
Reputation: 41
Thanks for all of your kind replies. With your help finally I found failure reason and solution. At start time I think item1.git is a file built by git when using "git init". With Edmoudo and Dave's help I realized that this item1.git is a directory and should be built by
git init --bare --shared item1.git
The second thing I realized is that I should clone the database first, i.e.
mkdir work1
cd work1
git clone xxxx/item1.git
Then in work1/item1 directory can i use command
git remote add short_name xxxx/item1.git
at this time i can use short_name for pull/push
Upvotes: 2
Reputation: 435
Add a shared bare repository to the remote directory first:
cd /prj/my_prj
git init --bare --shared item1.git
Then return to your local working directory and your push should work:
git push short_name master
Upvotes: 0