简体   繁体   中英

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.

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. 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.

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. It does not know if you have permissions there or if there is even a Git installation there at all. 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. Hope that helps.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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