git常见使用

以github为例,首先在github上添加仓库,如仓库名为pink;

创建本地的项目

1.直接clone,尚未创建项目  git clone https://github.com/xxxxx/pink.git

2.已有文件上关联git ,依次在项目文件夹目录下执行以下语句

git init

git add .

git remote add origin https://github.com/xxxxx/pink.git
//origin是默认的远程版本库的别名,一般都这么用,也可以取其他的名字;这句话用于在本地仓库和远程仓库间建立连接
git commit -m 'init' git push -u origin master
//master是分支名

在克隆好的项目中写代码,然后提交,先pull 再commit 最后push

猜你喜欢

转载自www.cnblogs.com/sycamore0802/p/12900489.html