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

前端 未结 8 1075
予麋鹿
予麋鹿 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条回答
  •  说谎
    说谎 (楼主)
    2021-01-30 02:40

    In the repository root, the .git/config file holds all information about remote repositories and branches. In your example, you should look for something like:

    [remote "origin"]
        fetch = +refs/heads/*:refs/remotes/origin/*
        url = server:gitRepo.git
    

    Also, the Git command git remote -v shows the remote repository name and URL. The "origin" remote repository usually corresponds to the original repository, from which the local copy was cloned.

提交回复
热议问题