首页 > 其他分享 >Git Tip: git push ‘No refs in common and none specified’

Git Tip: git push ‘No refs in common and none specified’

时间:2023-04-20 14:04:20浏览次数:33  
标签:none git No repo Git master common push


评:


@see http://www.thebuzzmedia.com/git-tip-git-push-no-refs-in-common-and-none-specified/


Git is a source-control tool used by software developers.

I recently switched from Subversion to Git and while things have been mostly smooth, there have been a few “WTF?” moments. I am going to try and blog the few beginner ones I ran into in hopes of helping anyone else.

Today I ran a ‘git push’ to shove my commits from my local repository back into the main remote repo, the result was this:

$ git push
No refs in common and none specified; doing nothing.
Perhaps you should specify a branch such as 'master'.
error: failed to push some refs to '[email protected]:painfreepr/<repo>.git'

The odd bit is that I had just done this with a previous repo about 30 mins ago and it worked fine; this was a new repository I was setting up. As it turns out this is the result of originally cloning an empty repository (link, link) which is exactly what I did. I had created a new repo on GitHub and wanted to pull the repo down in IntelliJ to then add some files to it via the GUI instead of from the command line; so I had checked out the empty repo right after creating it.

The fix, fortunately, is dead easy:

$ git push origin master

Doing this should provide output like:

$ git push origin master

Counting objects: 568, done.

Delta compression using up to 2 threads.

Compressing objects: 100% (559/559), done.

Writing objects: 100% (568/568), 2.28 MiB | 2.18 MiB/s, done.

Total 568 (delta 205), reused 0 (delta 0)

To [email protected]:painfreepr/<repo>.git

* [new branch] master -> master

It is my understanding that the core issue is that there are no files in commonbetween the original remote repo you cloned (empty) and the one on-disk (now full of files). Doing the git-push-origin-master shoves your repo up into the empty repository and gives you that common base again so you can do a ‘git push‘ without issue.

Happy Git’ing!

标签:none,git,No,repo,Git,master,common,push
From: https://blog.51cto.com/u_16080829/6209514

相关文章

  • git remote用法总结
    评:gitremotegitremote不带参数,列出已经存在的远程分支,例如:#gitremoteorigin_appsgitremote-v|--verbose列出详细信息,在每一个名字后面列出其远程url,例如:#gitremote-vorigin_appsgitolite@scm:apps/Welcome.git(fetch)origin_appsgitolite@scm:apps/W......
  • GIT 还原代码
    GIT还原代码方案一:强制推送此操作会强制将本地代码推送上去并让远程git上的版本库叶回退到你本地版本状态。步骤01.先使用hard方式回滚代码此步骤保证本地代码的内容已经和回退版本一致02.强制push强推方式有两种,勾选任意一种即可(两者区别:https://tortoisegit.org/do......
  • MySQL InnoDB Architecture 简要介绍
    MySQLInnoDB存储引擎整体架构图:一、内存存储结构 1、BufferPoolbufferpool是主内存中的一块儿存储区域,用于存储访问的表及索引数据。这样从内存中直接访问获取使用的数据可以极大的提升访问效率。在一些特殊专用的服务里,几乎80%的内存区域都被赋于bufferpool。为了......
  • Eddy's digital Roots 1163 (数学+九余数定理)
    Eddy'sdigitalRootsTimeLimit:2000/1000MS(Java/Others)   MemoryLimit:65536/32768K(Java/Others)TotalSubmission(s):5278   AcceptedSubmission(s):2952ProblemDescriptionThedigitalrootofapositiveintegerisfoundbysumming......
  • prometheus node-exporter安装
    目录prometheusnode-exporter安装包安装在linux服务器Daemonset安装Docker安装helm安装prometheusnode-exporter安装安装有很多中方法包安装在linux服务器NodeExporter是一个用于收集Linux系统信息并暴露为Prometheus格式的指标的守护进程。要启动NodeExporter,可以......
  • Git fetch和git pull的区别
    评:Git中从远程的分支获取最新的版本到本地有这样2个命令:1.gitfetch:相当于是从远程获取最新版本到本地,不会自动mergegitfetchoriginmastergitlog-pmaster..origin/mastergitmergeorigin/master以上命令的含义:首先从远程的origin的master主分支下载最新的版......
  • git 搭建服务器笔记
    评:-----------1服务器安装git----------1.在有yum的系统上(比如Fedora)yuminstallcurl-develexpat-develgettext-devel\openssl-develzlib-devel2.下面的Git官方站点下载最新版本源代码:http://git-scm.com/download3.编译并安装:$tar-zxfgit-1.7.2.......
  • Unknown character set: 'utf8mb4'
    评:Unknowncharacterset:'utf8mb4'从昨天晚上开始,困扰了我几个小时的问题,无论用c3p0还是用Spring的DriverManagerDataSource都无法连接我服务器上的远程数据库,一直报的错误就是:org.springframework.jdbc.CannotGetJdbcConnectionException:CouldnotgetJDBCConnection......
  • tomcat6启动报错java.lang.ClassNotFoundException: 1catalina.org.apache.juli.FileH
    评:tomcat6启动报错在apache-tomcat-6.0.26/logs/catalina.out日志里面报错:java.lang.ClassNotFoundException:1catalina.org.apache.juli.FileHandler这个是由于apache-tomcat-6.0.26/bin/catalina.sh文件被修改过了,应该把下面的一行放在-Djava.util.logging.manager的前......
  • git常用命令
    以下是一些常用的git命令:1.gitinit:将当前目录初始化为Git仓库。2.gitclone:克隆一个远程Git仓库到本地。3.gitadd:将文件添加到暂存区。4.gitcommit:将暂存区的文件提交到本地仓库。5.gitpush:将本地仓库的文件推送到远程仓库。6.gitpull:从远程仓库拉取文件到本地。......