Report this

What is the reason for this report?

How to set up automatic deploy for Angular apps through gh-pages

Posted on October 13, 2020

As I was following through the tutorial on the same topic (https://www.digitalocean.com/community/tutorials/how-to-set-up-automatic-deployment-with-git-with-a-vps), I successfully established a git repo at the vps, I even added remote live by git remote add live ssh://myuser@mydomain.com/var/repo/site.git I already have local git setup I regularly use git with my team.

The problem is now my project doesn’t have the repo name in the static files Url.

<head>
  <meta charset="utf-8">
  <title>AngularTourOfHeroes</title>
  <base href="/">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <link rel="icon" type="image/x-icon" href="favicon.ico">
  <link rel="stylesheet" href="styles.35b4cc1e4bf063be119d.css">
</head>


This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Heya,

Just came across this answer and decided to write some general guidelines for anyone who comes across this in the future despite the old question.

Normally these static files are served relative to the base URL declared in your code (like in your base href).

One way to include your repository’s name in your static file URLs would be to add it to the base href in your HTML file, or define it in environment configuration files (if your framework uses such files).

For example, you might change your base href to the following:

html

Remember to adjust the href value according to your server’s structure. Also, be sure to update any additional references to ensure they use the correct paths. It’s also a good idea to double check your server’s settings to make sure it’s properly configured to serve static files from the intended path.

For more information about GIT repository and linking to static files, please refer to the DigitalOcean documentation.

Regards

The developer cloud

Scale up as you grow — whether you're running one virtual machine or ten thousand.

Get started for free

Sign up and get $200 in credit for your first 60 days with DigitalOcean.*

*This promotional offer applies to new accounts only.