{"id":204535,"date":"2020-11-10T10:10:59","date_gmt":"2020-11-10T02:10:59","guid":{"rendered":"https:\/\/gulass.cn\/?p=204535"},"modified":"2020-11-02T10:11:42","modified_gmt":"2020-11-02T02:11:42","slug":"shell-git-github-gitee","status":"publish","type":"post","link":"https:\/\/gulass.cn\/shell-git-github-gitee.html","title":{"rendered":"Linux Shell\u540c\u65f6\u63a8\u9001\u4ee3\u7801\u81f3github\u548cgitee\u7684\u89e3\u51b3\u529e\u6cd5"},"content":{"rendered":"
\u81ea\u5df1\u5199\u7684\u4e1c\u897f\uff0c\u8981\u540c\u65f6\u63a8\u9001\u591a\u4e2agit\u5730\u5740\uff0c\u89e3\u51b3\u529e\u6cd5\u5982\u4e0b
\n<\/p>\n
1.\u5148\u8981\u521d\u59cb\u5316\u4f60\u7684git,\u8fdb\u5165\u81ea\u5df1\u7684\u9879\u76ee\u76ee\u5f55\uff0c\u7136\u540e\u6267\u884c git init<\/p>\n
cd \/app\/code\/go-study<\/pre>\ngit init<\/pre>\n\u521b\u5efa\u6267\u884c\u811a\u672c<\/strong><\/span><\/div>\n2.\u6267\u884c\u4ee5\u4e0b\u811a\u672c<\/p>\n
#!\/bin\/bash\r\n#author Oliver\r\n#since 2020-09-03 15:24:31\r\n \r\ngit remote rm origin\r\n#replace your git location\r\ngit remote add origin 'https:\/\/github.com\/**********'\r\ngit pull remote master\r\ngit add .\r\ngit commit -m $1\r\ngit push origin master --force\r\nif [ \"$?\" = \"0\" ]\r\nthen\r\n echo -e \"\\033[42;34m push to github success! \\033[0m\"\r\nelse\r\n echo -e \"\\033[41;30m push to github fail! \\033[0m\"\r\n exit 1\r\nfi\r\n \r\ngit remote rm origin\r\n#replace your git location\r\ngit remote add origin 'https:\/\/gitee.com\/**********'\r\ngit pull remote master\r\ngit add .\r\ngit commit -m $1\r\ngit push origin master --force\r\n \r\nif [ \"$?\" = \"0\" ]\r\nthen\r\n echo -e \"\\033[42;34m push to gitee success! \\033[0m\"\r\nelse\r\n ech -e \"\\033[41;30m push to gitee fail! \\033[0m\"\r\n exit 1\r\nfi\r\n<\/pre>\n3.\u6267\u884cshell\u811a\u672c\uff0c\u53ef\u4ee5\u4f20\u4e00\u4e2a\u53c2\u6570\u662fgit \u7684\u63d0\u4ea4\u7684msg\uff1a<\/p>\n
.\/shell.sh \"\u63d0\u4ea4\u4ee3\u7801\"<\/pre>\nPS\uff1a\u4e0b\u9762\u770b\u4e0bgit\u5f3a\u5236\u8986\u76d6\u672c\u5730\u4ee3\u7801\u548c\u5f3a\u5236\u63a8\u9001\u672c\u5730\u5230\u8fdc\u7a0b\u4ed3\u5e93<\/p>\n
1.git\u5f3a\u5236\u8986\u76d6\u672c\u5730\u6587\u4ef6\uff08\u4e0egit\u8fdc\u7a0b\u4ed3\u5e93\u4fdd\u6301\u4e00\u81f4\uff09\uff1a<\/p>\n
\r\ngit fetch --all\r\ngit reset --hard origin\/master\r\ngit pull\r\ngit\u5f3a\u5236\u8986\u76d6\u672c\u5730\u547d\u4ee4\uff08\u5355\u6761\u6267\u884c\uff09\uff1a\r\ngit fetch --all && git reset --hard origin\/master && git pull\r\n<\/pre>\n2.git\u5f3a\u5236\u63a8\u9001\u672c\u5730\u4ee3\u7801\u5230\u8fdc\u7a0b\u4ed3\u5e93<\/p>\n
\u5207\u6362\u5230\u5bf9\u5e94\u7684\u8981\u4e0a\u4f20\u6587\u4ef6\u7684\u6587\u4ef6\u5939\u4e0b\u9762\u6267\u884c\u547d\u4ee4<\/p>\n
\r\ngit push -u origin develop<\/pre>\n","protected":false},"excerpt":{"rendered":"\u81ea\u5df1\u5199\u7684\u4e1c\u897f\uff0c\u8981\u540c\u65f6\u63a8\u9001\u591a\u4e2agit\u5730\u5740\uff0c\u89e3\u51b3\u529e\u6cd5\u5982\u4e0b 1.\u5148\u8981\u521d\u59cb\u5316\u4f60\u7684git,\u8fdb\u5165\u81ea\u5df1\u7684\u9879\u76ee\u76ee\u5f55\uff0c\u7136\u540e\u6267\u884c […]<\/p>\n","protected":false},"author":362,"featured_media":204546,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[55],"tags":[],"class_list":["post-204535","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-thread"],"acf":[],"_links":{"self":[{"href":"https:\/\/gulass.cn\/wp-json\/wp\/v2\/posts\/204535","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/gulass.cn\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/gulass.cn\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/gulass.cn\/wp-json\/wp\/v2\/users\/362"}],"replies":[{"embeddable":true,"href":"https:\/\/gulass.cn\/wp-json\/wp\/v2\/comments?post=204535"}],"version-history":[{"count":10,"href":"https:\/\/gulass.cn\/wp-json\/wp\/v2\/posts\/204535\/revisions"}],"predecessor-version":[{"id":204633,"href":"https:\/\/gulass.cn\/wp-json\/wp\/v2\/posts\/204535\/revisions\/204633"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/gulass.cn\/wp-json\/wp\/v2\/media\/204546"}],"wp:attachment":[{"href":"https:\/\/gulass.cn\/wp-json\/wp\/v2\/media?parent=204535"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/gulass.cn\/wp-json\/wp\/v2\/categories?post=204535"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/gulass.cn\/wp-json\/wp\/v2\/tags?post=204535"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}