使用git在github上创建新工程

这段时间进经常会忘记如何在github上同步工程,于是又得查资料,查参考书,浪费了很长时间,因此有了感触,写几篇有关此类问题的篇章!

这是老手新手都十分容易犯的错误,就是在创建一个新github项目或者以本地已有项目为原型重新创建一个github项目时,容易创建一个空文件夹就直接关联远程仓库,这样做只会返回错误!!!所以,文件夹一定不能为空......

创建新工程需要的命令

完成本地项目与git的关联

cd 工程目录
git init    //初始化本地仓库,当前目录下会出现一个名为 .git 的目录
git add .    //将所有文件添加到缓存区,告诉 Git 开始对这些文件进行跟踪
git commit -am "Hello"    //提交文件到本地仓库

完成远程项目的创建

在github上创建某个项目,然后可以拷贝处该项目的地址

关联远程仓库(github上创建的地址)

git remote add origin https://github.com/Introspelliam/Hello.git    //关联远程仓库

push本地项目到远程仓库

git push origin master     //push项目到master
Username for 'https://github.com': //你的github账户名称

github上提供的工程创建方法

…or create a new repository on the command line

echo "# ctf-challenges" >> README.md
git init
git add README.md
git commit -m "first commit"
git remote add origin https://github.com/Introspelliam/ctf-challenges.git
git push -u origin master

…or push an existing repository from the command line

git remote add origin https://github.com/Introspelliam/ctf-challenges.git
git push -u origin master

 参考文档:https://introspelliam.github.io/2017/06/30/tools/%E4%BD%BF%E7%94%A8git%E5%9C%A8github%E4%B8%8A%E5%88%9B%E5%BB%BA%E6%96%B0%E5%B7%A5%E7%A8%8B/

转载于:https://www.cnblogs.com/dylancao/p/9692188.html

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值