Get Git repo url using absolute path

13,080
git --git-dir=/home/username/myFolder/.git config --get remote.origin.url
Share:
13,080
Ionică Bizău
Author by

Ionică Bizău

💻 Programmer ⚡️ Geek 🎹 Pianist & Organist 🚀 Learner 💡 Mentor 💫 Dreamer 🍏 Vegetarian 🙏 Jesus follower Website | GitHub | Twitter | PayPal Donations

Updated on June 11, 2022

Comments

  • Ionică Bizău
    Ionică Bizău almost 2 years

    I can get the repository path running the following command in the repository folder (like it was suggested here):

    git config --get remote.origin.url
    

    How can I get the git repository url using an absolute path?

    Suppose that I am in another folder and I want to get the repository url from another folder, using an absolute path.

    I tried this, but doesn't work.

    git config --get remote.origin.url --path /home/username/myFolder
    
  • Ionică Bizău
    Ionică Bizău over 10 years
    Good, but not complete. The .git folder has to be added after --git-dir path, like here. I edited your answer.
  • forivall
    forivall over 10 years
    Yeah, I just typed that in from memory, not remembering that it needs the bare repo (the .git folder). Thanks!
  • Abdulla Nilam
    Abdulla Nilam almost 6 years
    Nice and clean.