リモートレポジトリをローカルに取り込む
GitHubのURLを確認。ここではbootstrapを検索し[Clone or Download]をクリック、URLを確認 (Use SSHをクリックしSSHのURLを取得)ローカルのGitでダウンロードするパスに移動
ここでは「C:\www\bootstrap」とした。
test@test-PC MINGW32 /c/www/test2 (master)
$ cd c:/www
test@test-PC MINGW32 /c/www (master)
$ mkdir bootstrap
test@test-PC MINGW32 /c/www (master)
$ cd bootstrap
test@test-PC MINGW32 /c/www/bootstrap (master)
$ pwd
/c/www/bootstrap
$ cd c:/www
test@test-PC MINGW32 /c/www (master)
$ mkdir bootstrap
test@test-PC MINGW32 /c/www (master)
$ cd bootstrap
test@test-PC MINGW32 /c/www/bootstrap (master)
$ pwd
/c/www/bootstrap
git clone レポジトリURL でローカルに取り込む
test@test-PC MINGW32 /c/www/bootstrap (master)
$ git clone git@github.com:twbs/bootstrap.git
Cloning into 'bootstrap'...
Enter passphrase for key '/c/Users/test/.ssh/id_rsa':
remote: Counting objects: 122677, done.
remote: Compressing objects: 100% (20/20), done.
remote: Total 122677 (delta 3), reused 9 (delta 2), pack-reused 122653R
Receiving objects: 100% (122677/122677), 116.79 MiB | 5.10 MiB/s, done.
Resolving deltas: 100% (81569/81569), done.
$ git clone git@github.com:twbs/bootstrap.git
Cloning into 'bootstrap'...
Enter passphrase for key '/c/Users/test/.ssh/id_rsa':
remote: Counting objects: 122677, done.
remote: Compressing objects: 100% (20/20), done.
remote: Total 122677 (delta 3), reused 9 (delta 2), pack-reused 122653R
Receiving objects: 100% (122677/122677), 116.79 MiB | 5.10 MiB/s, done.
Resolving deltas: 100% (81569/81569), done.
先ほど自分で作成したリモートレポジトリをローカルに取り込む
ローカルパスは「C:\www\remote」とした
test@test-PC MINGW32 /c/www/bootstrap (master)
$ cd ..
test@test-PC MINGW32 /c/www (master)
$ mkdir remote
test@test-PC MINGW32 /c/www (master)
$ cd remote
test@test-PC MINGW32 /c/www/remote (master)
$ cd ..
test@test-PC MINGW32 /c/www (master)
$ mkdir remote
test@test-PC MINGW32 /c/www (master)
$ cd remote
test@test-PC MINGW32 /c/www/remote (master)
ローカルに取り込む
test@test-PC MINGW32 /c/www/remote (master)
$ git clone git@github.com:xxxx/test.git
Cloning into 'test'...
Enter passphrase for key '/c/Users/test/.ssh/id_rsa':
remote: Counting objects: 3, done.
remote: Total 3 (delta 0), reused 3 (delta 0), pack-reused 0
Receiving objects: 100% (3/3), done.
$ git clone git@github.com:xxxx/test.git
Cloning into 'test'...
Enter passphrase for key '/c/Users/test/.ssh/id_rsa':
remote: Counting objects: 3, done.
remote: Total 3 (delta 0), reused 3 (delta 0), pack-reused 0
Receiving objects: 100% (3/3), done.
ローカルに取り込んだREADME.mdに"てすと"を追記しコミット
test@test-PC MINGW32 /c/www/remote (master)
$ cd test
test@test-PC MINGW32 /c/www/remote/test (master)
$ echo "てすと" >> README.md
test@test-PC MINGW32 /c/www/remote/test (master)
$ cat README.md
hello
てすと
test@test-PC MINGW32 /c/www/remote/test (master)
$ git add README.md
test@test-PC MINGW32 /c/www/remote/test (master)
$ git commit -m "add test"
[master 40b7ea6] add test
1 file changed, 1 insertion(+)
$ cd test
test@test-PC MINGW32 /c/www/remote/test (master)
$ echo "てすと" >> README.md
test@test-PC MINGW32 /c/www/remote/test (master)
$ cat README.md
hello
てすと
test@test-PC MINGW32 /c/www/remote/test (master)
$ git add README.md
test@test-PC MINGW32 /c/www/remote/test (master)
$ git commit -m "add test"
[master 40b7ea6] add test
1 file changed, 1 insertion(+)
リモートレポジトリに反映
test@test-PC MINGW32 /c/www/remote/test (master)
$ git push origin master
Warning: Permanently added the RSA host key for IP address '192.30.255.112' to t
he list of known hosts.
Enter passphrase for key '/c/Users/test/.ssh/id_rsa':
Counting objects: 3, done.
Writing objects: 100% (3/3), 260 bytes | 130.00 KiB/s, done.
Total 3 (delta 0), reused 0 (delta 0)
To github.com:xxxx/test.git
bdb0c2f..40b7ea6 master -> master
$ git push origin master
Warning: Permanently added the RSA host key for IP address '192.30.255.112' to t
he list of known hosts.
Enter passphrase for key '/c/Users/test/.ssh/id_rsa':
Counting objects: 3, done.
Writing objects: 100% (3/3), 260 bytes | 130.00 KiB/s, done.
Total 3 (delta 0), reused 0 (delta 0)
To github.com:xxxx/test.git
bdb0c2f..40b7ea6 master -> master
GitHubで確認
リモートリポジトリの更新をローカルに取り込む
git pull リモート名 ブランチ名test@test-PC MINGW32 /c/www/remote/test (master)
$ cd ..
test@test-PC MINGW32 /c/www/remote (master)
$ cd ..
test@test-PC MINGW32 /c/www (master)
$ cd test2
test@test-PC MINGW32 /c/www/test2 (master)
$ pwd
/c/www/test2
test@test-PC MINGW32 /c/www/test2 (master)
$ cat README.md
hello
test@test-PC MINGW32 /c/www/test2 (master)
$ git pull test master
Enter passphrase for key '/c/Users/test/.ssh/id_rsa':
remote: Counting objects: 3, done.
remote: Total 3 (delta 0), reused 3 (delta 0), pack-reused 0
Unpacking objects: 100% (3/3), done.
From github.com:masatenb/test
* branch master -> FETCH_HEAD
bdb0c2f..40b7ea6 master -> test/master
Updating bdb0c2f..40b7ea6
Fast-forward
README.md | 1 +
1 file changed, 1 insertion(+)
$ cd ..
test@test-PC MINGW32 /c/www/remote (master)
$ cd ..
test@test-PC MINGW32 /c/www (master)
$ cd test2
test@test-PC MINGW32 /c/www/test2 (master)
$ pwd
/c/www/test2
test@test-PC MINGW32 /c/www/test2 (master)
$ cat README.md
hello
test@test-PC MINGW32 /c/www/test2 (master)
$ git pull test master
Enter passphrase for key '/c/Users/test/.ssh/id_rsa':
remote: Counting objects: 3, done.
remote: Total 3 (delta 0), reused 3 (delta 0), pack-reused 0
Unpacking objects: 100% (3/3), done.
From github.com:masatenb/test
* branch master -> FETCH_HEAD
bdb0c2f..40b7ea6 master -> test/master
Updating bdb0c2f..40b7ea6
Fast-forward
README.md | 1 +
1 file changed, 1 insertion(+)
更新されたことを確認
test@test-PC MINGW32 /c/www/test2 (master)
$ cat README.md
hello
てすと
$ cat README.md
hello
てすと
0 件のコメント:
コメントを投稿