Git & GitHub: verschil tussen versies

Uit De Vliegende Brigade
Naar navigatie springen Naar zoeken springen
Regel 42: Regel 42:
 
rm -rf reponame
 
rm -rf reponame
 
</pre>
 
</pre>
 +
 +
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 ==
 
== Clone the main branch ==

Versie van 5 jan 2023 18:29

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 only the main branch? E.g.: A collection of bash files?

See also

Sources