简体   繁体   English

Git-有什么方法可以从本地仓库创建全新的远程仓库吗?

[英]Git - Is there any way to create a brand new remote repo from a local repo?

I want to create a brand new, currently not existing, remote repo in git from a local repo. 我想在本地仓库中用git创建一个全新的,当前不存在的远程仓库。

I have already looked at many of the answers here, almost all involve something similar to the following: 我已经在这里查看了许多答案,几乎所有答案都与以下内容类似:

mkdir test2
cd test2
git init
cat > somefile
git add *
git commit -m 'd'
git remote add origin git@git.myserver.com:myorg/myrepo
# also tried git remote add origin git@git.myserver.com:myorg/myrepo.git
git push origin master

However, the response I get is always: 但是,我得到的响应始终是:

ERROR: Repository not found.
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

I am an owner/admin of the org, and should have all permissions on it. 我是该组织的所有者/管理员,应该对此拥有所有权限。 The repo myrepo does not exist, I am trying to create it from a remote machine. repo myrepo不存在,我正在尝试从远程计算机创建它。 Is there anyway to do this or is it a server side option or something similar? 无论如何,这是服务器端选项还是类似的东西? I do not have access to the git server to make modifications there, and would really prefer not to have to make them all using the http interface. 我没有访问git服务器在那里进行修改的权限,并且真的希望不必使用http界面进行全部修改。

The short answer is no. 最简洁的答案是不。 Think of it like this: Git has no way of knowing what is on the other side of the URL you specify as the remote. 这样想:Git无法知道您指定为远程URL另一端的内容。 It does not know if you have permissions there or if there is even a Git installation there at all. 它不知道您在那里是否具有权限,或者根本不存在Git安装。 The only way you can make a remote repository is to go to the remote location and create one, for example by logging into GitHub, or logging into git.myserver.com and creating the repository there. 创建远程存储库的唯一方法是转到远程位置并创建一个远程存储库,例如,通过登录GitHub或登录git.myserver.com并在此处创建存储库。 Hope that helps. 希望能有所帮助。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM