git使用笔记 bitbucket基本操作

实现目标:

1.将本地已经存在的项目文件保存到 bitbucket.org
2.从 bitbucket.org 检出代码库到本地

操作笔记:
1.首先在bitbucket.org创建一个代码库,并得到代码库的地址 https://username@bitbucket.org/username/ledcard.git
2.打开Git Bash,进入到项目工程目录
$ cd D:/cygwin/usr/LedCard/
3.创建本次git仓库
$ git init
4.添加和提交
$ git add * #将工程目录下所有文件添加到缓存目录(Index)
$ git commit -m “提交注释” #将文件提交到HEAD,但是这些提交还在本地,还没有在远端仓库
5.推送改动
将本地仓库连接到远端仓库
$ git remote add origin https://username@bitbucket.org/username/ledcard.git
推送到远端仓库
$ git push -u origin –all
6.完成,打开 bitbucket.org ,查看该代码仓库,可以看到文件都已上传
7.检出代码库
切换到需要的目录
$ cd e:
$ mkdir ledcard
$ cd ./ledcard/
检出远端仓库
$ git clone https://username@bitbucket.org/username/ledcard.git
8.完成,打开本地目录,查看文件,可以看到文件已经全部检出。

参考文档:http://rogerdudler.github.io/git-guide/index.zh.html

原文地址:https://www.cnblogs.com/fdyang/p/7230260.html