如何使用 SourceTree 创建新的 git 存储库?
How to create new git repository with SourceTree?
这是我目前所做的(在 SourceTree 中):
- 选择“创建新存储库”
- 选择目标路径(“hallo”)
- 在“hallo”目录中创建一个文件
- 提交该文件(创建本地主分支)
- 创建一个新的远程(ssh://xxx@192.168.162.20:22/srv/git/hallo)
- 推送到远程分支
现在我得到一个错误:
git -c diff.mnemonicprefix=false -c core.quotepath=false push -v --tags --set-upstream origin master:master
Pushing to ssh://xxx@192.168.162.20:22/srv/git/hallo
fatal: '/srv/git/hallo' does not appear to be a git repository
fatal: Could not read from remote repository.
我正在使用该服务器上的许多其他存储库,没有任何困难。所以它不可能是访问或 ssh 问题。我也仔细检查了服务器的IP地址。
如果我启动终端并写入“git remote -v”,我得到:
origin ssh://xxx@192.168.162.20:22/srv/git/hallo (fetch)
origin ssh://xxx@192.168.162.20:22/srv/git/hallo (push)
如果我尝试推送 ("git push origin master") 我得到:
fatal: '/srv/git/hallo' does not appear to be a git repository
fatal: Could not read from remote repository.
请确保您拥有正确的访问权限
并且存储库存在。
我不知道我错过了什么。
你能帮忙吗?
No, I didn't. Do I have to? I thought pushing a commit will do this for me.
是的,您应该先创建一个远程仓库。
连接到 ssh://xxx@192.168.162.20:22,并创建一个裸仓库:
cd /srv/git/
git init --bare hallo
这是我目前所做的(在 SourceTree 中):
- 选择“创建新存储库”
- 选择目标路径(“hallo”)
- 在“hallo”目录中创建一个文件
- 提交该文件(创建本地主分支)
- 创建一个新的远程(ssh://xxx@192.168.162.20:22/srv/git/hallo)
- 推送到远程分支
现在我得到一个错误:
git -c diff.mnemonicprefix=false -c core.quotepath=false push -v --tags --set-upstream origin master:master
Pushing to ssh://xxx@192.168.162.20:22/srv/git/hallo
fatal: '/srv/git/hallo' does not appear to be a git repository
fatal: Could not read from remote repository.
我正在使用该服务器上的许多其他存储库,没有任何困难。所以它不可能是访问或 ssh 问题。我也仔细检查了服务器的IP地址。
如果我启动终端并写入“git remote -v”,我得到:
origin ssh://xxx@192.168.162.20:22/srv/git/hallo (fetch)
origin ssh://xxx@192.168.162.20:22/srv/git/hallo (push)
如果我尝试推送 ("git push origin master") 我得到:
fatal: '/srv/git/hallo' does not appear to be a git repository
fatal: Could not read from remote repository.
请确保您拥有正确的访问权限 并且存储库存在。
我不知道我错过了什么。 你能帮忙吗?
No, I didn't. Do I have to? I thought pushing a commit will do this for me.
是的,您应该先创建一个远程仓库。
连接到 ssh://xxx@192.168.162.20:22,并创建一个裸仓库:
cd /srv/git/
git init --bare hallo