2017-11-18 9 views
3

私はgitを学んでいるので、プライベートレポジトリをGitHubに設定しました。私のgithubプライベートレポジトリにプッシュできません

## github 
     Host github.com 
     User git 
     HostName github.com 
     IdentityFile ~/.ssh/github.key 

私は成功した私のGitHubのアカウントに接続することができます:

$ ssh -T github 
    Hi <UserName>! You've successfully authenticated, but GitHub does not provide shell access. 

私が持っている私は、SSHキーを作成し、私のGitHubのアカウントにそれを格納し、私の地元のLinuxマシン上の.ssh/configファイルを編集しています私のローカルマシン上でgitリポジトリを初期化し、ユーザーを設定し、リモートリポジトリを追加しました:私はREADME.mdファイルを作成している

$ git init 
    $ git config user.name "UserName" 
    $ git config user.email "UserEmail" 
    $ git remote add origin ssh://github:<UserName?/<repositoryName>.git 

を、gitのためにそれを追加し、それをコミット:

$ git add README.md 
    $ git commit -m "First commit." 

は今、毎回私はこのエラーを取得し、プッシュしよう:

$ git push origin master 

    ERROR: Repository not found. 
    fatal: Could not read from remote repository. 

    Please make sure you have the correct access rights 
    and the repository exists. 

リポジトリ作品を複製、しかし、それは私が行うことができる唯一のことです。

私のプライベートレポジトリにプッシュできないのはなぜですか?私は間違って何をしていますか?

+0

以前から、あなたが – Magnus

+0

gitのは、リモート-V' '入力した場合、私は'プッシュと同じエラーが出る何を得るのですか'コマンド。 – user44697

答えて

3

はあなた~/.ssh/configファイルが使用されていることを確認するために、代わりにscp syntaxをお試しください:

git remote set-url origin github:<username>/<repo> 

次に試してみて、もう一度押してください。のみ

ssh://[[email protected]]host.xz[:port]/path/to/repo.git 
vs. 
[email protected]:/path/to/repo.git 

:ASが "Why doesn't the ssh command follow RFC on URI?" で説明

> ssh -V 
OpenSSH_7.5p1, OpenSSL 1.0.2k 26 Jan 2017 


Gitにそれ自体が(Git for Windowsを有する少なくとも一つのパッケージ)OpenSSHのバージョンを使用し、差があります後者の構文[email protected]:ssh config fileを使用します。

When SSH was originally developed, it was developed as a more secure, drop-in replacement for the earlier RSH/rlogin suite of tools.

History of the SSH protocol」を参照してください。

OpenSSH(1999)URI(2005年1月に発表され、RFC 3986に完成)

If the host portion was allowed to be on the form host:port , this would create a potential ambiguity: does [email protected]:2222 refer to ~jdoe/2222 on host.example.com when connecting on the standard port, or does it refer to no file at all (or worse, ~jdoe) on host.example.com when connecting over port 2222?

+0

チャームのように働いた。受け入れられupvoted。なぜそれが 'ssh://'でうまくいかないのか説明できますか? – user44697

+1

@ user44697最初のssh:// host:port/pathはURIスキームに従いますが、sshはURIに先行します:https://unix.stackexchange.com/a/75672/7490 – VonC

関連する問題