搜索
您的当前位置:首页正文

Git 初始化Repository操作

来源:二三娱乐

Command line instructions

Git global setup

git config --global user.name "UserName"
git config --global user.email 

Create a new repository

git clone 
cd DrivingExamApi
touch README.md
git add README.md
git commit -m "add README"
git push -u origin master

Existing folder or Git repository

cd existing_folder
git init
git remote add orign 
git add .
git commit
git push -u origin master

注意:如果项目是用在XCode上的,建议在GitHub上创建项目时不要勾选创建ReadMe.md和.gitignore 不然的话在XCode上无法初始化推送。

CreateNewRepository.png XCodeSourceControl.png AddRemote.png

当然,如果你嫌麻烦,完全可以按照下面的Git命令来操作。
以下是在GitHub上新建一个项目后GitHub提供的提示信息:

…or create a new repository on the command line

echo "# HelloSwift" >> README.md
git init
git add README.md
git commit -m "first commit"
git remote add origin 
git push -u origin master

…or push an existing repository from the command line

git remote add origin 
git push -u origin master

关注我的公众号.jpg
Top