Git遇到的坑(二)

我写了一个项目很长时间,但是不会用git,一直没有机会实践,今天进行了实践。我在项目中首先运行了下面几条命令:

git init (初始化项目)

git add . (把所有信息添加到git本地控制)

git commit -m "自己随便写,最好是根据功能写"

测试能否连接到github,输入以下命令:

ssh -T git@github.com

如果测试成功会出现一大堆英文说成功。

git remote add origin  <url>

前提是你在github上创建了仓库:

出现了以下错误:

warning: no common commits
remote: Enumerating objects: 6, done.
remote: Counting objects: 100% (6/6), done.
remote: Compressing objects: 100% (3/3), done.
remote: Total 6 (delta 0), reused 3 (delta 0), pack-reused 0
Unpacking objects: 100% (6/6), done.
From github.com:WangXin1708/GraphicCreateGrid
 * [new branch]      master     -> origin/master
There is no tracking information for the current branch.
Please specify which branch you want to merge with.
See git-pull(1) for details.

    git pull <remote> <branch>

If you wish to set tracking information for this branch you can do so with:

    git branch --set-upstream-to=origin/<branch> master

这样你可以 git branch --set-upstream-to=origin/master

然后输入

 git pull --allow-unrelated-histories

然后直接git push


 

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值