{"id":418,"date":"2011-10-12T00:56:04","date_gmt":"2011-10-12T00:56:04","guid":{"rendered":"http:\/\/41j.com\/blog\/?p=418"},"modified":"2011-11-30T19:45:02","modified_gmt":"2011-11-30T19:45:02","slug":"simple-git-example-remote-repository","status":"publish","type":"post","link":"https:\/\/41j.com\/blog\/2011\/10\/simple-git-example-remote-repository\/","title":{"rendered":"Simple git example (remote repository)"},"content":{"rendered":"<p>In the <a href=\"http:\/\/41j.com\/blog\/2011\/10\/simple-git-example-local-repository\/\">last example<\/a> we were working with a purely local repository. This example shows you how to work with remote repositories.<\/p>\n<p>We&#8217;re going to convert the local repository we previously created in to a &#8220;bare&#8221; repository, this is a repository we can easily do &#8220;pushes&#8221; and &#8220;pulls&#8221; from (like commits and updates in svn). Once you&#8217;ve done this you won&#8217;t use this central repository to work on directly, it&#8217;ll just be where everything is stored.<\/p>\n<p>0. On your &#8220;server&#8221;, convert the repository to be a &#8220;bare&#8221; repository.<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\ncd testproject\r\ngit config --bool core.bare true\r\n<\/pre>\n<p>1. On your client &#8220;clone&#8221; (checkout in svn nomenclature) the repository.<\/p>\n<p>This depends on how you&#8217;re accessing the repository but if it&#8217;s over ssh you can do this:<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\ngit clone ssh:\/\/myuser@myserver.internet.com\/home\/myuser\/testproject\r\n<\/pre>\n<p>2. Create a file and push it (commit in svn nomenclature):<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\ntouch remotetest\r\ngit add remotetest\r\ngit commit remotetest\r\ngit push\r\n<\/pre>\n<p>3. Pull the latest version (update in svn nomenclature):<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\ngit pull\r\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>In the last example we were working with a purely local repository. This example shows you how to work with remote repositories. We&#8217;re going to convert the local repository we previously created in to a &#8220;bare&#8221; repository, this is a repository we can easily do &#8220;pushes&#8221; and &#8220;pulls&#8221; from (like commits and updates in svn). [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":false,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[1],"tags":[6,8,7],"class_list":["post-418","post","type-post","status-publish","format-standard","hentry","category-uncategorized","tag-git","tag-revision-control","tag-svn"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_shortlink":"https:\/\/wp.me\/p1RRoU-6K","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/41j.com\/blog\/wp-json\/wp\/v2\/posts\/418","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/41j.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/41j.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/41j.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/41j.com\/blog\/wp-json\/wp\/v2\/comments?post=418"}],"version-history":[{"count":6,"href":"https:\/\/41j.com\/blog\/wp-json\/wp\/v2\/posts\/418\/revisions"}],"predecessor-version":[{"id":629,"href":"https:\/\/41j.com\/blog\/wp-json\/wp\/v2\/posts\/418\/revisions\/629"}],"wp:attachment":[{"href":"https:\/\/41j.com\/blog\/wp-json\/wp\/v2\/media?parent=418"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/41j.com\/blog\/wp-json\/wp\/v2\/categories?post=418"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/41j.com\/blog\/wp-json\/wp\/v2\/tags?post=418"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}