Github

The unauthenticated git protocol on port 9418 is no longer supported

I have been using GitHub actions for quite some time but today my deployments started failing. Below is the error from GitHub action logs

Command: git
Arguments: ls-remote --tags --heads git://github.com/adobe-webplatform/eve.git
Directory: /home/runner/work/stackstream-fe/stackstream-fe
Output:
fatal: remote error: 
  The unauthenticated git protocol on port 9418 is no longer supported.

Upon investigation, it appears that the below section in my yml file is causing the issue.

    - name: Installing modules
      run: yarn install

Answer:

 

Try using the following command before installing:

git config --global url."https://".insteadOf git://

better use the reduced version git config --global url."https://github.com/".insteadOf git://github.com/

fatal: unsafe repository (‘/home/repon’ is owned by someone else)

I found an error log from apache2 that is fatal: unsafe repository (‘/home/repon’ is owned by someone else) It is because I have ‘git rev-parse –symbolic-full-name –abbrev-ref HEAD’ in PHP code and looks like a new git safety change(https://github.blog/2022-04-12-git-security-vulnerability-announced/) no longer allows www-data run this git command, git config –global –add safe.directory /homerepon does not work, anyone has a workaround here to solve this issue? git version: 2.35.3 php version: 7.4 apache2 version: 2.4.41

Answer

This started appearing with the release of the git 2.35.2 security update which fixes vulnerabilities described here. credits @Juan-Kabbali

Here are 4 possible solutions:

  • trust git directory (do it if you know the directory contents are safe)
git config --global --add safe.directory /home/repon

This adds to ~/.gitconfig the safe group as shown in this example

[safe]
    directory = /home/repon
  • run the command as the correct user, for example:
sudo -u ubuntu -- git status

Note: This requires user www-data to have permission to execute the git command as user ubuntu (assuming ubuntu is the repository owner). For this to work, you will need to add a new file inside /etc/sudoers.d/ with the following contents:

www-data ALL=(ubuntu) NOPASSWD: /usr/bin/git

This may have security implications so refer to your security guy first.

  • change git repository owner to www-data
sudo chown -R www-data:www-data /home/repon
  • downgrade git as a temporary solution. For example in Ubuntu:
apt install git-man=1:2.17.0-1ubuntu1 git=1:2.17.0-1ubuntu1

Note: At least on Windows, it appears that all git repositories on ejectable drives are considered unsafe and changing ownership does not seem to work.

[resolved] Heroku and Github : Items could not be retrieved, Internal server error

I’m beginning with Heroku and I simply want to connect to my GitHub account. When I do it, I get this error message as a small red pop-up on the upper right side of the page: Items could not be retrieved, Internal server error. Could someone help me, please?

This is due to an issue reported at their status portal, here.

For now, the solution is to use another pushing strategy. The best one, for now, is using their remote with Heroku CLI. The steps for it are:

1. Install the Heroku CLI if not yet installed

Further information about installation and setup can get here

2. Perform login with the heroku login command

You will be prompted with your default browser window for completing the login at the Heroku portal.

3. Assuming you already have your app set up at Heroku (if not, please follow this), you just need to add a new remote for your git repo with Heroku CLI.

Run heroku git:remote -a example-app – substitute “example-app” with your app name.

4. git remote -v to check if the remote has been set successfully

You should see something like this appear as a response

heroku  https://git.heroku.com/your-app-name.git (fetch)
heroku  https://git.heroku.com/your-app-name.git (push)

5. Push your branch to the new heroku remote

git push heroku your_branch_name

6. You should see the progress of your deployment being displayed in the terminal


The reference for this answer has been taken from here, which can also be used if further information other than the one provided in this answer is needed.