User Tools

Site Tools


github_commands

GitHub Commands

The following are all commands performed at a Linux terminal

To create a new folder on Github:

git add foldername

Note: A folder must already exist in the location where the repository has been cloned

To create a file under a folder:

touch filename

Note: It is important to git add the new file within the folder too otherwise a git commit will not work.

To commit changes made:

git commit -m “new folder”

Note: A comment always needs to be added when a commit is performed

To push changes to the repository:

git push

You will be prompted for your github Username and Password. The password is not password used to logon to your github account it is a PERSONAL ACCESS TOKEN that needs to be setup.

To remove a folder:

git rm foldername -r

Creating a Personal Access Token

1. Within your GitHub account go to settings from the top right menu

github_settings.jpg

2. Select “Developer Settings” from the Settings menu

github_developer.jpg

3. Expand “Personal Access Tokens” and click “Tokens (Classic)”

github_personal_access_tokens.jpg

4. Click “Generate new token” and from the drop down select “Generate new token (classic)”

github_classic_tokens.jpg

5. Give the token an appropriate name under “Note”. Select an appropriate Expiration time. Select all scopes that apply to the token you want to create. For example all scopes can be selected allowing all operations

github_token_access.jpggithub_token_access1.jpg

Once scopes have been added. Click “Generate token”.

6. Copy the token code and keep in a safe place as it cannot be seen again once you leave the screen

github_token_granted.jpg

This token replaces the password that is used for authentication with Github commands

github_commands.txt · Last modified: by 127.0.0.1