用命令行向GitHub添加Project

1、首先在GitHub创建一个新的仓库,为了避免出错,不要用README license,gitignore 初始化仓库。这些可以稍后再添加。

e1505dcae7ba1a9d848da9d29e304ba522a.jpg
2、打开本地电脑安装的Git Bash

17adbbca3c6e9405620cc0ba88527a22af0.jpg
3、将当前工作目录指向本地项目所在目录。

4f3baa6fd40954eba42b1a7d2235624ce75.jpg
4、初始化本地目录,作为Git仓库

$ git init


5、添加文件到新的本地仓库。这是第一次提交阶段

$ git add .
# Adds the files in the local repository and stages them for commit. To unstage a file, use 'git reset HEAD YOUR-FILE'.


6、提交文件

$ git commit -m "First commit"
# Commits the tracked changes and prepares them to be pushed to a remote repository. To remove this commit and modify the file, use 'git reset --soft HEAD~1' and commit and add the file again.


7、复制GitHub仓库快速设置页面的远程仓库URL

a2c8603e22f7d417a2eef4567b95f16d109.jpg
8、在命令提示符中,添加远程仓库URL

$ git remote add origin remote repository URL
# Sets the new remote
$ git remote -v
# Verifies the new remote URL


9、向GitHub推送本地仓库有改动的文件
 

$ git push origin master
# Pushes the changes in your local repository up to the remote repository you specified as the origin

 

转载于:https://my.oschina.net/benz001/blog/3059498

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值