一、上传代码
- 在要上传的代码目录里点击鼠标右键,选择git bash here
初始化git:
git init //会自动创建一个隐藏文件夹.git
- 更新本文件夹下的文件被上传状态
git status
- 添加将要上传的文件或文件夹,使用git add
git add file
注意:如果要上传文件夹,在文件夹后加上’’
git add dir/
也可以使用git add --all上传当前目录下的所有文件
- 添加代码提交的commit
git commit -m "your commit here"
- 连接github建立的远程仓库链接,获取仓库的SSH地址:
执行:
git remote add origin [email protected]:shuoyueqishi/spring-boot.git
- 从远程仓库更新
git pull origin master --allow-unrelated-histories
弹出的文件关闭之后会进行更新
- 最后push本地代码
git push -u origin master
二、下载代码
- 新建存放下载代码的文件夹,进入文件夹
- 找到要下载的仓库的url
- 使用
git clone url下载
git clone [email protected]:shuoyueqishi/spring-boot.git
相关文章: