github_ファイルをアップロードしてみた_error: The requested URL returned error_Gtk-WARNING **: cannot open display:
前提環境
ホストOS windows10上
ゲストOS centos6.9
githubでアカウントは作成済み
ゲストOSにGIT導入済み
ホストOS,ゲストOSともにインターネットアクセスOK
github account= gitdaaaaaaaaaaa
repository name =repdaaaaaaaaaaaaa
githubアカウント作成時に用いたemailaddress:xxxxxx@gmail.com
1.windows10上でgithubのページにアカウント情報用いてログイン
githubで新規repositoryを作成(2個目)
ログイン後画面右上+ボタン→[New repository]をクリック
[Public]をチェック
[Initialize the repository with a README]にチェック
後[Create repository]をクリック
2.画面右上[Your Profile]をクリック→作成したリポジトリ名をクリック
→URLをコピーしておく
https://github.com/gitdaaaaaaaaaaa/repdaaaaaaaaaaaaa
3.仮想環境上でgitのインストール実施
#git clone https://github.com/gitdaaaaaaaaaaa/repdaaaaaaaaaaaaa
#カレントディレクトリにrepdaaaaaaaaaaaaaが作成されるので、push予定のファイルをmvやらcpで
repdaaaaaaaaaaaaaに移動させておく
#cd repdaaaaaaaaaaaaa
#git add python.py
#git status
# On branch master
# Changes to be committed:
# (use "git reset HEAD <file>..." to unstage)
#
# new file: zen.txt
#
コミットする。ただしうまくいかない
# git commit -m "uploadtest"
[master 896f795] uploadtest
Committer: root <root@centos69.(none)>
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:
git config --global user.name "Your Name"
git config --global user.email you@example.com
If the identity used for this commit is wrong, you can fix it with:
git commit --amend --author='Your Name <you@example.com>'
6 files changed, 214 insertions(+), 0 deletions(-)
create mode 100644 zen.txt
メッセージどおり、以下2コマンド実施
# git config --global user.name "gitdaaaaaaaaaaa"
# git config --global user.email "xxxxxx@gmail.com"
今度は成功の模様
# git commit -m "uploadtest"
# On branch master
# Your branch is ahead of 'origin/master' by 1 commit.
#
nothing to commit (working directory clean)
いよいよファイルのpush
ただしまたもエラー
# git push origin master
error: The requested URL returned error: 403 Forbidden while accessing https://github.com/gitdaaaaaaaaaaa/repdaaaaaaaaaaaaa/info/refs
fatal: HTTP request failed
google先生よい
https://qiita.com/tatetate55/items/593ea9d1e3e422059839
を参考にして
git remote set-url origin
を実施
# git remote set-url origin https://gitdaaaaaaaaaaa@github.com/gitdaaaaaaaaaaa/repdaaaaaaaaaaaaa/info/refs
再度プッシュ実施
ただしまた別エラー
# git push origin master
(gnome-ssh-askpass:xxxxx): Gtk-WARNING **: cannot open display:
(xxxxxは数字)
以下を参考に
unset SSH_ASKPASS
を実施したらpush成功
https://h2ham.net/git-gnome-ssh-askpass-gtk-warning-cannot-open-display
# unset SSH_ASKPASS
# git push origin master
Password:
Counting objects: 9, done.
Compressing objects: 100% (7/7), done.
Writing objects: 100% (8/8), 2.05 KiB, done.
Total 8 (delta 2), reused 0 (delta 0)
remote: Resolving deltas: 100% (2/2), done.
To https://dokugaku190302@github.com/dokugaku190302/dokugaku2
6d9b0c3..896f795 master -> master
ーー>URLからもファイルがみえた。