LoginSignup
0
2

More than 5 years have passed since last update.

GIt

Last updated at Posted at 2018-11-21

サーバ側での作業

リモートリポジトリの作成

Git Bashを使って、bareリポジトリを作成する。

mkdir /c/git
mkidir /c/git/GitTest.git
cd /c/git/GitTest.git
git init --bare --shared

sshサーバの立ち上げ

  • C:\Bitnami\redmine\git\usr\bin\sshd.exeをクリックする。  →タスクマネージャーにsshd.exeが出現する。

クライアント側の作業

Gitリポジトリの作成

  • Visual StudioでGitTestソリューションを作成する。
  • SourcetreeでGitリポジトリを作成する。  ※「次のアカウントでリポジトリを作成」はチェック不要
  • Sourcetreeでコミットする。
  • Sourcetreeでリモートリポジトリを指定する。  ssh://{windows user}@192.168.11.9:22/c/git/GitTest.git

コマンド

[プッシュ]
1. 初期設定
 git config --global user.name "${name}"
 git config --global user.email ${email}
  git config -l
2. リポジトリ作成
 git init
3. ステージング
  git add test.txt
  git status
4. コミット
 git commit -m "test"
 git log
5. プッシュ
 git remote add origin ${url} // リモートリポジトリの登録
  git remote -v
 git push -u origin master

※origin: リモートリポジトリ
※master: ブランチ

[クローン]
git clone [url]

[プル]
git pull // リモートリポジトリの登録が事前に必要

参考

リモートリポジトリの作成からクローンまで

サーバ側

  • gitインストール
  • gitのuser設定
  • ベアリポジトリ作成
  • sshキー作成
  • sshd起動 ※PC再起動のたびに必要

bat: Git Bashで実行(コマンドプロンプトからではダメ)
/usr/bin/sshd.exe

クライアント側

  • クローン  git clone ssh://user@ip/remote-path

sshで通信する

サーバ側

  • sshd起動

クライアント側

  • ssh接続  ssh user@IPアドレス(例: 192.168.214.60)
    • ファイル転送  scp -r test user@IPアドレス:/c/test
0
2
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
0
2