Xcode 中 Git 的配置與使用主要圍繞下面幾個問題展開闡述:git
建立代碼庫有兩種方式:json
方式1:新建工程的時候建立xcode
1. 勾選Create Git repository on 服務器
2. 會自動建立隱藏文件源.git文件app
方式2:把現有的工程拷貝到代碼庫下,再初始化代碼庫spa
1. 進入工程目錄code
cd /Users/Jerry/Desktop/Document/OC練習/05-git
2. 建立並初始化一個源blog
git init
3. 把工程拷貝到源裏面並完成第一次提交it
git add .
git commit -m 'First Commit'
LinKundeMacBook-Pro-3:/ Jerry$ cd /Users/Jerry/Desktop/Document/OC練習/05-git LinKundeMacBook-Pro-3:05-git Jerry$ git init Initialized empty Git repository in /Users/Jerry/Desktop/Document/OC練習/05-git/.git/ LinKundeMacBook-Pro-3:05-git Jerry$ ls -a . .git 05-gitTests .. 05-git 05-gitUITests .DS_Store 05-git.xcodeproj LinKundeMacBook-Pro-3:05-git Jerry$ git add . LinKundeMacBook-Pro-3:05-git Jerry$ git commit -m 'First Commit' [master (root-commit) 71cd1a9] First Commit 19 files changed, 1058 insertions(+) create mode 100644 .DS_Store create mode 100644 05-git.xcodeproj/project.pbxproj create mode 100644 05-git.xcodeproj/project.xcworkspace/contents.xcworkspacedata create mode 100644 05-git.xcodeproj/project.xcworkspace/xcuserdata/Jerry.xcuserdatad/UserInterfaceState.xcuserstate create mode 100644 05-git.xcodeproj/xcuserdata/Jerry.xcuserdatad/xcschemes/05-git.xcscheme create mode 100644 05-git.xcodeproj/xcuserdata/Jerry.xcuserdatad/xcschemes/xcschememanagement.plist create mode 100644 05-git/AppDelegate.h create mode 100644 05-git/AppDelegate.m create mode 100644 05-git/Assets.xcassets/AppIcon.appiconset/Contents.json create mode 100644 05-git/Base.lproj/LaunchScreen.storyboard create mode 100644 05-git/Base.lproj/Main.storyboard create mode 100644 05-git/Info.plist create mode 100644 05-git/ViewController.h create mode 100644 05-git/ViewController.m create mode 100644 05-git/main.m create mode 100644 05-gitTests/Info.plist create mode 100644 05-gitTests/_5_gitTests.m create mode 100644 05-gitUITests/Info.plist create mode 100644 05-gitUITests/_5_gitUITests.m LinKundeMacBook-Pro-3:05-git Jerry$
1. 配置遠程服務器代碼庫名 io