1、創(chuàng)建項目
登陸碼云,創(chuàng)建項目:
1.1、已有項目的導(dǎo)入(指的是已經(jīng)托管的項目);
1.2、創(chuàng)建項目后期關(guān)聯(lián)本地項目。
2、關(guān)聯(lián)本地項目
2.1、把本地項目設(shè)置成倉庫
如果本地項目沒有倉庫,需要初始化成倉庫:
2.1.1、cd到本地項目文件夾;
2.1.2、git init(打開本地項目文件夾,查看是否有 .git 文件,如果沒有的話在終端輸入:
defaults write com.apple.finder AppleShowAllFiles -bool true )。
重啟finder,再次查看。
提示:創(chuàng)建項目的時候可以直接初始化為倉庫(打勾即可)。
3、配置git
3.1.1、git config --global user.name "John Doe”
git config --global user.email johndoe@example.com
查看配置列表:git config --list
查看單一配置項 git config user.name
3、添加忽略項
方法一:
在終端,1、vim .gitignore
2、輸入 i 進(jìn)入編輯模式。https://github.com/github/gitignorefind file ,輸入objective 語言忽略項,復(fù)制。
3、esc 退出編輯 ---- x 保存(等于 wq )
方法二:
在終端,1、touch .gitignore(創(chuàng)建這個文件)
2、open .gitignore 。 https://github.com/github/gitignore</font> find file ,輸入objective 語言忽略項,復(fù)制-保存。
3、(等于 wq )
(刪除文件 rm 文件名)
3、進(jìn)行關(guān)聯(lián)
1、 git remote add origin 碼云地址
2、(第一次拉取的時候)git pull origin master --allow-unrelated-histories</br>
3、git push -u origin master
4、git add .
5、git status -s
6、git commit -m '備注內(nèi)容'