Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/wix/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
从旧项目中删除剩余的git引用_Git_Gitlab - Fatal编程技术网

从旧项目中删除剩余的git引用

从旧项目中删除剩余的git引用,git,gitlab,Git,Gitlab,我正在做一个项目,现在我想把文件夹上传到另一个项目 我正在尝试运行以下命令: cd existing_folder git init git remote add origin git@gitlab.com:myname/project.git git add . git commit -m "Initial commit" git push -u origin master 但是,我得到了一个错误: error: src refspec master does not m

我正在做一个项目,现在我想把文件夹上传到另一个项目

我正在尝试运行以下命令:

cd existing_folder
git init
git remote add origin git@gitlab.com:myname/project.git
git add .
git commit -m "Initial commit"
git push -u origin master
但是,我得到了一个错误:

error: src refspec master does not match any
error: failed to push some refs to 'gitlab.com:myname/project.git'
当我尝试推送现有文件夹时

我有另一家回购公司留下的旧遥控器。我删除了以下内容:

git remote rm origin
但是,我注意到,当我尝试运行时,REF仍然给我错误的数据

git show-ref
我明白了

隐藏可能是因为我以前使用过sourcetree


任何帮助都将不胜感激。有没有办法从旧项目中重置所有这些连接?我尝试重新安装,但没有任何更改。我认为这些引用可能是问题所在?

所以你说在一个已经有
.git
存储库的文件夹中
git init
?这可能不像你想象的那样。如果目标是扔掉现有的
.git
repo并重新开始,那么您确实需要扔掉它。但你当然会失去所有现存的历史

我怎样才能放弃回购协议?该项目已连接到不是我的远程gitlab存储库。这些文件本身只有.gitignore和gitlab-ci.yamlYou,但我丢失了。:)你说“我有一个不同的回购协议留下的旧遥控器”。如果没有
.git
文件夹,那是不可能的。如果前面没有现有的git repo,那么您可能就在其中。然后我把它拿走了。这就是我的意思。对不起,我是新来的。如果有任何其他方法来澄清这一点,我很高兴给出所有信息,但是在没有
.git
文件夹的文件夹上,在
git init
之后,
remote-v
将是空的。我真的不知道为什么.git不在那里。我甚至只是重新运行git init,我添加的旧远程设备仍然存在。
long code refs/heads/branch-from-old-project
long code refs/heads/branch2-from-old-project
long code refs/stash