How do you get the Git repository's name in some Git repository?

前端 未结 17 1300
囚心锁ツ
囚心锁ツ 2020-12-22 16:18

When you are working in some Git directory, how can you get the Git repository name in some Git repository? Are there any Git commands?

# I did check out bar         


        
17条回答
  •  盖世英雄少女心
    2020-12-22 16:54

    If you want the whole GitHub repository name ('full name') - user/repository, and you want to do it in with Ruby...

    git remote show origin -n | ruby -ne 'puts /^\s*Fetch.*:(.*).git/.match($_)[1] rescue nil'
    

提交回复
热议问题