I would like to provide a URL to a subfolder of a GitHub repo in a paper I am about to submit. I thought the link should look like github.com/account/reponame/folder/subfolder
, but I realised now that when navigating through the repo, I need to write github.com/account/reponame/tree/main/folder/subfolder
for the link to work. Can I assume a link with this format to be persistent, or is there a better way of ensuring that the URL is useful for a long time?
CodePudding user response:
the /tree/master/ just indicates the master branch is being accessed. The link would be active till someone with edit access to the repo changes the folder structure or deletes it. If it is a repo with shared edit access, I would suggest you to fork it and make it private and then share the link from the fork so that no one would make changes to the path other than you.
CodePudding user response:
It is safer to refer to a specific commit, that is:
github.com/account/reponame/tree/COMMITID/main/folder/subfolder
Where COMMITID
is the SHA hash of your commit, which should look like 56e05fced214c44a37759efa2dfc25a65d8ae98d
That way, you can still push changes to your repo, and the reviewers still will get access to the specific version you want.