Importing Private Git Repositories with Non-Default Ports in Go
When attempting to import a private git repository hosted on a non-standard port using a remote import path, you may encounter issues. Despite documentation suggesting otherwise, specifying ports explicitly in remote import paths is not supported.
One workaround is to modify your .gitconfig file to define a custom remote with the appropriate port. Add the following section to your .gitconfig:
[url "[email protected]:6655"] insteadOf = git://internal-git.corporate-domain.com
This change allows you to import the repository using the following syntax:
import "internal-git.corporate-domain.com/~myuser/golang-lib.git"
By modifying your .gitconfig, Go will automatically resolve the URL with the specified port when attempting to import the repository, resolving the issue with non-default ports.
The above is the detailed content of How to Import Private Git Repositories with Non-Default Ports in Go?. For more information, please follow other related articles on the PHP Chinese website!