Skip to main content

git fatal: The current branch {} has no upstream branch

When attempting to do a git push, are you getting the following response:

fatal: The current branch main has no upstream branch.
To push the current branch and set the remote as upstream, use

git push --set-upstream origin main

 

Quick solution, instead run the command

git push origin main

And the response will push what you were attempting to do

Recently viewed pages

This code is from Drupal 9 back-end for a React front-end via REST API.

Working through the output for recently viewed pages... the code structure:

How to remove .DS_Store from your git repo

Working from the bases that .DS_Store has not been added to your git repository, then you can add it to your .gitignore file.

touch .gitignore

In the .gitignore file add the following

# Hide the DS_Store files
**/.DS_Store

However, if it's already there, then in Terminal you will need to write:

OSX : Convert a putty .ppk key to a .pem file

How do you generate a .pem file from an existing .ppk key?

Is putty on your mac?

Check by running the command

puttygen -V

Which will generate a response similar to 

puttygen: Release 0.76
Build platform: 64-bit Unix
Compiler: clang 12.0.5 (clang-1205.0.22.9)
Source commit: 1fd7baa7344bb....

Don't have Putty, well easily fixed with homebrew.

How to use the Poll module and passing via RESTful API

 

Using the Drupal Poll module and passing via RESTful API -  How do you get it working?

 

The initial set-up

POST: {domain}/mhc_custom/poll?_format=json
Content-type: application/json
Accept: application/json

{
  "choice": "1"
}

 

If you run the above credentials, you will find the following response

How to recover or change or reset your password using REST

How to use the Drupal REST API to trigger I've forgot (need to change) my password.

POST: {domain}/user/password?_format=hal_json
Content-type: application/hal_json
Accept: application/hal+json

Or if you are using hal_json then use

POST: {domain}/user/password?_format=json
Content-type: application/json
Accept: application/json

Body

Drupal REST how to get an image

In retrieving an image, the primary element required is:
  • File id or fid;
 

Query string

Using the element outlined above the query string becomes:

{domain}/file/{fid}/?_format=hal_json

Replacing the following variables:

Drupal how to use node GET command

For an introduction into setting up RESTful hal+json refer to the set-up documentation.

GET a node

To get the content of the specific node you require the node.nid.  The key information required in the GET query:

Drupal how to use node POST command

For an introduction into setting up RESTful hal+json refer to the set-up documentation.

POST command

Following on from the GET command, to post a node to the site (currently staging) is quite quick.  To do so, complete the following:

Request: {domain}/entity/node

Content-Type: application/hal+json

Node PATCH command

For an introduction into setting up RESTful hal+json refer to the set-up documentation.

PATCH command

Following on from the GET command, to patch a node to the site (currently staging) is quite quick.  To be able to PATCH an article, the member needs to have authority to do so.  All members can update their own content.  However, they cannot update any one else's content.

Outline of the details required to make a PATCH:

Subscribe to