Search code examples
gitgithubgit-remote

Git fetch won't work for private repo


I have a project in git repository which makes use of a library in another repository. For that I am adding the library repository as a remote and link with the project. It was working fine with bitbucket repositories (public) but when I moved the library to a Github private repository the fetch does not work. It doesn't throw any error but it just does not fetch any file. Could it be something related with the fact that the library is in a private repository now? And is there a way to accomplish this?

These are the steps I used:

git remote add library https://[email protected]/XXXX.git
git fetch library

Solution

  • Use a different scheme:

    git remote add library https://<username>@bitbucket.org/<username>/<repo>.git
    

    Note, <username> is used twice.