78 lines
3.3 KiB
HTML
78 lines
3.3 KiB
HTML
<!doctype html>
|
|
<html>
|
|
<head>
|
|
<meta charset="utf-8">
|
|
<meta http-equiv="x-ua-compatible" content="ie=edge">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
|
|
|
|
<link rel="stylesheet" href="/css/hacker.css">
|
|
<link rel="stylesheet" href="extra.css">
|
|
|
|
<link rel="alternate" type="application/rss+xml" title="Subscribe to this page..." href="feed.rss" />
|
|
<title>git remotes with ssh aliases</title>
|
|
<meta name='twitter:card' content='summary' />
|
|
<meta name='twitter:site' content='@nebsirrah' />
|
|
<meta name='twitter:title' content='git remotes with ssh aliases' />
|
|
<meta name='twitter:description' content=" did you know that ~/.ssh/config aliases work for git remotes?? ~/.ssh/config Host gh HostName github.com User git IdentityFile ~/.ssh/gh_key you can now use gh:username/repo as the remote in place of git@github.com:username/repo, which is much " />
|
|
</head><body>
|
|
<div class="container">
|
|
|
|
<div id="divbodyholder">
|
|
<div class="headerholder"><div class="header">
|
|
<div id="title">
|
|
<h1 class="nomargin"><a class="ablack" href="https://tilde.team/~ben/blog/index.html">blog // ~ben</a></h1>
|
|
<div id="description">a blog about tildes and other things</div>
|
|
</div></div></div>
|
|
<div id="divbody"><div class="content">
|
|
<!-- entry begin -->
|
|
<h3><a class="ablack" href="git-remotes-with-ssh-aliases.html">
|
|
git remotes with ssh aliases
|
|
</a></h3>
|
|
<!-- bashblog_timestamp: #201801121330.26# -->
|
|
<div class="subtitle">January 12, 2018 —
|
|
ben
|
|
</div>
|
|
<!-- text begin -->
|
|
|
|
<p>did you know that <code>~/.ssh/config</code> aliases work for git remotes??</p>
|
|
|
|
<p>~/.ssh/config</p>
|
|
|
|
<pre>
|
|
Host gh
|
|
HostName github.com
|
|
User git
|
|
IdentityFile ~/.ssh/gh_key
|
|
</pre>
|
|
|
|
<p>you can now use <code>gh:username/repo</code> as the remote in place of <code>git@github.com:username/repo</code>, which is much shorter and easier to type many times!</p>
|
|
|
|
<p><code>git clone gh:benharri/learngit</code></p>
|
|
|
|
<p>there are many other use cases for the <code>ssh_config</code> file. for example, here is my config for the tilde machine for easy ssh connections.</p>
|
|
|
|
<pre>
|
|
Host tilde
|
|
HostName tilde.team
|
|
User ben
|
|
</pre>
|
|
|
|
<p>then use <code>ssh tilde</code> to start a new ssh session. this also works with <code>scp</code>: try something like this <code>scp file.txt tilde:workspace/.</code> in place of <code>scp file.txt ben@tilde.team:workspace/.</code></p>
|
|
|
|
<p>the ssh_config file is super useful. check <code>man ssh_config</code> for a full list of options!</p>
|
|
|
|
<p>Tags: <a href='tag_git.html'>git</a>, <a href='tag_ssh.html'>ssh</a></p>
|
|
|
|
|
|
<!-- text end -->
|
|
<p id='twitter'><a href='http://twitter.com/intent/tweet?url=https://tilde.team/~ben/blog/git-remotes-with-ssh-aliases.html&text=<Type your comment here but please leave the URL so that other people can follow the comments>&via=nebsirrah'>Comments? Tweet</a>
|
|
<a href='https://twitter.com/search?q=https://tilde.team/~ben/blog/git-remotes-with-ssh-aliases.html'><span id='count-28113'></span></a> </p>
|
|
<!-- entry end -->
|
|
</div>
|
|
<div id="footer">CC by-nc-nd <a href="https://tilde.team/~ben/">~ben</a> — <a href="mailto:ben@tilde.team">ben@tilde.team</a><br/>
|
|
Generated with <a href="https://github.com/cfenollosa/bashblog">bashblog</a>, a single bash script to easily create blogs like this one</div>
|
|
</div></div>
|
|
</div>
|
|
<br>
|
|
</body></html>
|