LoginSignup
1
1

More than 3 years have passed since last update.

ローカルリポジトリAをリモートリポジトリとして利用する

Last updated at Posted at 2019-05-24

[github] <--> [PC-A] <--> [PC-B]
みたいな環境で開発はPC-Bで行いたいが、Bからgithubに直通できない状況を想定。
(※A-BはSSHで接続可能)

> ssh user@pc-a
password: *****
> cd ~/ProjectName
> git config --bool core.bare true # これがFalseだとpushを受け付けない
> exit

> git clone ssh://user@pc-a/~/ProjectName
password: *****

> cd ProjectName
> touch hoge < echo "Makimaki is very cute!"
> git add hoge
> git commit -m "Add file"
> git push

pushしたものはPC-A上でもコミットが積み上げられる。最終的にPC-Aでpushすればgithubにも反される。

PS
bare=trueにすると、PC-A上でコミット等ができなくなる。
PC-Bでの作業が終わったらPC-Aでbare=falseに戻すことでPC-AでGit作業が出来るように戻った。

1
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
1