【发布时间】:2017-10-24 16:13:21
【问题描述】:
用了一段时间git,很强大很漂亮..
但也有一些困惑:
在我初始化一个 git repo 之后,它应该在分支 master 下,不是吗?
但是git branch -a,我什么都没有。
当我尝试为我的分支设置上游时,我得到了fatal: branch 'master' does not exist。
users@debian MINGW64 ~/Desktop/taste
$ git init
Initialized empty Git repository in C:/Users/users/Desktop/taste/.git/
users@debian MINGW64 ~/Desktop/taste (master)
$ git remote add origin git@gitee.com:greedev/Test.git
users@debian MINGW64 ~/Desktop/taste (master)
$ git branch -u origin/master
fatal: branch 'master' does not exist
users@debian MINGW64 ~/Desktop/taste (master)
$ git branch -a
users@debian MINGW64 ~/Desktop/taste (master)
$ git fetch
The authenticity of host 'gitee.com (120.55.226.24)' can't be established.
ECDSA key fingerprint is SHA256:FQGC9Kn/eye1W8icdBgrQp+KkGYoFgbVr17bmjey0Wc.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added 'gitee.com,120.55.226.24' (ECDSA) to the list of know n hosts.
remote: Counting objects: 7, done.
remote: Compressing objects: 100% (6/6), done.
remote: Total 7 (delta 0), reused 0 (delta 0)
Unpacking objects: 100% (7/7), done.
From gitee.com:greedev/Test
* [new branch] master -> origin/master
users@debian MINGW64 ~/Desktop/taste (master)
$ git branch -a
remotes/origin/master
users@debian MINGW64 ~/Desktop/taste (master)
$ git branch -u origin/master
fatal: branch 'master' does not exist
【问题讨论】:
标签: git git-branch