Git & GitHub: verschil tussen versies

Uit De Vliegende Brigade
Naar navigatie springen Naar zoeken springen
Regel 49: Regel 49:
 
How to download a clone of a specific branch, like the ''main branch''? E.g.: A collection of bash files?
 
How to download a clone of a specific branch, like the ''main branch''? E.g.: A collection of bash files?
  
== Deploy ==
+
Or am I asking the wrong question? I actually want to ''deploy'' the stuff that's stored on GitHub (although that's the wrong term) → See below
 +
 
 +
== Deploy (?) ==
 +
 
 +
How to ''deploy'', ''publish'' or ''use'' the stuff that's in GitHub?
 +
 
 +
* For starters: ''Deploy'' seems the wrong term: It only leads to pages about ''GitHub Pages'' and that's not what I mean
 +
* Maybe has to do with some two-step procedure including ''staging''?
 +
* Specifically: I want the script files in repository ''devliegendebrigade/scripts'' (or whatever) to magically appear in <code>/usr/local/bin</code> on servers, and in <code>Dropbox/Overhead/Scripts</code> on my laptop (or maybe I want to change that also to <code>/usr/local/bin</code>, now that I don't need Dropbox as backup for these).
 +
 
  
 
== See also ==
 
== See also ==

Versie van 5 jan 2023 19:15

Finally! It's 2022 and I'm ready for the 21st century: We're adopting Git - The most popular Distributed Version Control System (VCS), in combination with GitHub.

Git clients - Sublime Merge

Interacting with repositories like GitHub, SVN or Bitbucket can be done using the command line, but it's more common to use a graphical Git client for this. One of these is Sublime Merge. Since Sublime Text is my default editor, I think I'll try Sublime Merge. See Sublime Merge for details, but changes are, that the main stuff is included in this article

GitHub

In practice, you'll probably spend more time at the website of the Git repository of choice, than of the site of Git itself. We use GitHub. You need a personal GitHub account and you somehow need access to personal repositories, or those of an organisation

Personal Access Token

  • A Github Personal Access Token is an alternative for a password, used for replicating through the API. Sublime Merge needs them. You can do so here: https://github.com/settings/tokens
  • Cloning a repository with Sublime Merge: I had to provide both my usual GitHub login name and the token.

Clone a repository

When you clone a repository, you get a copy of all versions of all files - Not just the main branch. See [1] for details.

On the GitHub site, see Organisation » Code » Local for details.

Sublime Merge

  • You can only use the HTTPS variant, not SSH
  • Create a personal access token (see above)
  • Sublime Merge » File » Clone repository

Command line

  • GitHub » Profile » Settings » SSH and GPG keys: Upload the computer's public key
  • git clone git@github.com:project_name/reponame.git

Remove a clone

[2]:

From within the directory that holds the .git file:

git gc --prune=all
cd ..
rm -rf reponame

BTW: As far as I can tell, GitHub doesn't keep track of where repositories have been cloned - I can clone & destroy them as often as I want (for practicing purposes) without creating weird meta data.

Clone the main branch

How to download a clone of a specific branch, like the main branch? E.g.: A collection of bash files?

Or am I asking the wrong question? I actually want to deploy the stuff that's stored on GitHub (although that's the wrong term) → See below

Deploy (?)

How to deploy, publish or use the stuff that's in GitHub?

  • For starters: Deploy seems the wrong term: It only leads to pages about GitHub Pages and that's not what I mean
  • Maybe has to do with some two-step procedure including staging?
  • Specifically: I want the script files in repository devliegendebrigade/scripts (or whatever) to magically appear in /usr/local/bin on servers, and in Dropbox/Overhead/Scripts on my laptop (or maybe I want to change that also to /usr/local/bin, now that I don't need Dropbox as backup for these).


See also

Sources