01-09-2021, 10:08 AM
Let's look at how we can install git on our own linux system, clone a repo, and get started with basic git config settings.
read_more
It's easy to install Git on Fedora / CentOS :
You can also choose to install the git-all package instead, to download all git related sub packages.
Getting Started - Installing Git :
https://git-scm.com/book/en/v2/Getting-S...alling-Git
--
Next you may want to create a new Git repo, or clone an existing Git repo.
To create a new git repo on the command line, cd to the directory you want to work in and type :
To clone a Git repo from Github on the command line, copy the link from a repo and use git clone to download the files locally :
You have the choice of using https, ssh or github cli links to clone a repo. If you plan on using ssh you'll need to setup your own ssh keys.
On Github the clone with ssh links only show up when you're logged in.
More on how to fork a repo :
https://docs.github.com/en/github/gettin...ork-a-repo
--
Git Ignore :
Always be one step ahead.
Before making your first commit, it's a good idea to create a .gitignore file for your new repo, and double check your git config settings.
Make a habit out of adding a .gitignore file before anything else, to save time and avoid accidentally commiting sensitive files that you will need to remove later.
Git Config :
https://git-scm.com/docs/git-config
Also check your settings in git config and ensure your username / email address is setup properly.
You can have system level, global and local config settings. In some cases your username / email may need to be set to different accounts for different repos.
Using multiple git accounts on the same system.
When cloning a repo using ssh, git will use your global config unless you specify the account directly in the clone path.
First you'll need to setup multiple ssh keys. Read more about the process in the link below.
How to manage multiple GitHub accounts on a single machine with SSH keys :
https://www.freecodecamp.org/news/manage...dc30ccaca/
--
If you haven't setup your username and email in the git config file yet, you'll see a message like this when you add a git commit :
git used the information from the current shell environment to set the username and email, and this may be incorrect for the repo you're working on.
You would need to edit your git config to add in your correct github account details.
--
Getting Started - First-Time Git Setup :
https://git-scm.com/book/en/v2/Getting-S...-Git-Setup
More guides to help you get started with Git :
https://ninjadmins.com/topic/getting-sta...urces-list
read_more
It's easy to install Git on Fedora / CentOS :
Quote:sudo dnf install git
You can also choose to install the git-all package instead, to download all git related sub packages.
Getting Started - Installing Git :
https://git-scm.com/book/en/v2/Getting-S...alling-Git
--
Next you may want to create a new Git repo, or clone an existing Git repo.
To create a new git repo on the command line, cd to the directory you want to work in and type :
Quote:git init
To clone a Git repo from Github on the command line, copy the link from a repo and use git clone to download the files locally :
Quote:git clone git@github.com:ninjadmins/my-blog-app.git
You have the choice of using https, ssh or github cli links to clone a repo. If you plan on using ssh you'll need to setup your own ssh keys.
On Github the clone with ssh links only show up when you're logged in.
More on how to fork a repo :
https://docs.github.com/en/github/gettin...ork-a-repo
--
Git Ignore :
Always be one step ahead.
Before making your first commit, it's a good idea to create a .gitignore file for your new repo, and double check your git config settings.
Make a habit out of adding a .gitignore file before anything else, to save time and avoid accidentally commiting sensitive files that you will need to remove later.
Git Config :
https://git-scm.com/docs/git-config
Also check your settings in git config and ensure your username / email address is setup properly.
You can have system level, global and local config settings. In some cases your username / email may need to be set to different accounts for different repos.
Quote:git config --list
git config --global
git config --local
Using multiple git accounts on the same system.
When cloning a repo using ssh, git will use your global config unless you specify the account directly in the clone path.
First you'll need to setup multiple ssh keys. Read more about the process in the link below.
How to manage multiple GitHub accounts on a single machine with SSH keys :
https://www.freecodecamp.org/news/manage...dc30ccaca/
--
If you haven't setup your username and email in the git config file yet, you'll see a message like this when you add a git commit :
Quote: git commit -m "update readme"
[master 43672f7] update readme
Committer: ninja <ninja@f32.server>
Your name and email address were configured automatically based
on your username and hostname. Please check that they are accurate.
You can suppress this message by setting them explicitly. Run the
following command and follow the instructions in your editor to edit
your configuration file:
git config --global --edit
After doing this, you may fix the identity used for this commit with:
git commit --amend --reset-author
1 file changed, 12 insertions(+), 5 deletions(-)
git used the information from the current shell environment to set the username and email, and this may be incorrect for the repo you're working on.
You would need to edit your git config to add in your correct github account details.
--
Getting Started - First-Time Git Setup :
https://git-scm.com/book/en/v2/Getting-S...-Git-Setup
More guides to help you get started with Git :
https://ninjadmins.com/topic/getting-sta...urces-list
[ Ninja Admins Community Manager ]
