[英]How to push update to a branch in github
讓我知道我在這里做錯了嗎?
當我做$git status
它顯示我的分支為* my_branch
現在我更改了幾個文件,並嘗試將更新推送到分支,所以我嘗試了兩件事-
1) 第一次嘗試
$ git add .
$ git push origin my_branch
這顯示Everything up-to-date
2) 第二次嘗試
$ git add .
git commit -m "first commit"
現在在運行它,我得到以下錯誤-
*** Please tell me who you are.
Run
git config --global user.email "you@example.com"
git config --global user.name "Your Name"
to set your account's default identity.
Omit --global to set the identity only in this repository.
fatal: unable to auto-detect email address (got 'trialcoder@sysuser.(none)')
這里發生了一些事情。 首先,您需要了解添加和提交之間的區別。
add
階段以跟蹤文件。
commit
提交更改,並取消跟蹤文件。 (想法是現在就完成了。)
第一次嘗試時,您添加了要跟蹤的文件,但沒有對版本控制添加任何更改。 當您執行push
,它會推送您的提交。 因為沒有提交,它說一切都是最新的,這是正確的。
其次,您嘗試提交更改。 Git需要來自用戶的電子郵件地址才能提交更改。 這樣您就知道是誰進行了更改。 您尚未告訴git您的電子郵件地址,因此要求您這樣做才能成功提交。 您所需要做的就是執行消息也告訴您的命令。 使用您喜歡的任何電子郵件/名稱。 如果是公司,則應該使用@company電子郵件地址。 如果這是針對github的,則應使用用於注冊github的電子郵件。 否則,沒關系,只使用一個就是你。
git config --global user.email "you@example.com"
git config --global user.name "Your Name"
然后繼續執行:
git commit -m "first commit"
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.