Finding out the name of the original repository you cloned from in Git

前端 未结 8 1087
予麋鹿
予麋鹿 2021-01-30 01:51

When you do your first clone using the syntax

git clone username@server:gitRepo.git

Is it possible using your local repository to find the name

8条回答
  •  旧时难觅i
    2021-01-30 02:22

    I use this:

    basename $(git remote get-url origin) .git
    

    Which returns something like gitRepo. (Remove the .git at the end of the command to return something like gitRepo.git.)

    (Note: It requires Git version 2.7.0 or later)

提交回复
热议问题