Skip to content

Instantly share code, notes, and snippets.

@onigra
Last active December 11, 2015 08:39
Show Gist options
  • Save onigra/4574678 to your computer and use it in GitHub Desktop.
Save onigra/4574678 to your computer and use it in GitHub Desktop.
リモートリポジトリの作り方

Gitリモートリポジトリの作り方

サーバ側作業

ユーザー作成

adduser gitrepo
usermod -a -G gitrepo onigra

リポジトリ作成

su - gitrepo
mkdir testproject.git
cd testproject.git
git --bare init

クライアント側作業

クライアント側で作成したプロジェクトをpushする

mkdir testproject
cd testproject
git init
echo "git test" > readme
git add .
git commit -m "first commit"
git remote add origin ssh://configのHostに記述した名前/home/gitrepo/testproject.git
git push origin master

cloneして変更を加えてpushしてみる

git clone ssh://configのHostに記述した名前/home/gitrepo/testproject.git
echo "oeeee" >> readme
git add .
git commit -m "change test"
git push origin master
git pull
cat readme
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment